시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 2048 MB298726.923%

문제

You are given an array $a$ of $n$ integers. You can perform operations on this array. In a single operation, you can add any real number $x$ to some consecutive interval of $a$.

Determine the minimum number of operations that have to be performed to make all elements of $a$ equal to $0$.

입력

The first line contains an integer $n$ ($1 \leq n \leq 23$).

The second line contains the array $a_1, a_2, \ldots, a_n$ ($0 \leq a_i \leq 10^9$).

출력

Print a line with a single integer: the minimum number of operations needed.

예제 입력 1

5
1 2 3 2 1

예제 출력 1

3

예제 입력 2

6
1 1 4 5 1 4

예제 출력 2

4