Baby Chaves was playing with his Christmas gift and he got it all messed up, oh no!
His gift was an array of length $$$N$$$ ($$$1\le N\le 10^5$$$) where he can make the following operations: Choose two consecutive numbers in the array, then add $$$k$$$ to one of the numbers and subtract $$$k$$$ from the other one, where $$$k$$$ could be any integer.
Baby Chaves got some of the integers in the array negative, a big mistake as his mom doesn't like negative integers. You don't have much time to fix this before his mom comes home, so tell Baby Chaves what is the minimum number of operations needed to make all the numbers in the array non-negative, that is, greater than or equal to $$$0$$$.
The first line contains $$$N\; (1\le N\le 10^5)$$$ — the length of the array.
The second line contains $$$N$$$ integers $$$a_1, a_2, \dots, a_n\; (-10^9\le a_i \le 10^9)$$$ — the array.
Print $$$-1$$$ if it isn't possible to make all the numbers non-negative; otherwise, print the minimum number of operations needed.
5-8 0 15 0 -2
4
5-10 12 2 -8 2
-1
10
0
In the first sample, you could do the following operations:
In the third sample, the values of the array are already non-negative so you need $$$0$$$ operations.
| Название |
|---|


