~/algor $ cat problems/massiv-ishora-almashinishlari
Number of sign changes
Easy
1000 ms
64 MB
30%
An array of $n$ integers is given. For how many pairs of adjacent elements does the sign change — one is positive and the other negative? ($0$ is neither positive nor negative.)
Input
The first line contains a positive integer $n$.
The second line contains $n$ integers — the elements of the array.
Output
One integer — the number of sign changes.
Note
$1 \le n \le 1000$
the elements are from $-10^{6}$ to $10^{6}$
Examples
Input #1
7 3 -2 -5 4 0 -1 6
Output #1
3
Input #2
1 -4
Output #2
0