#CCBCHBAHAI0000067. Đếm số lần đổi dấu giữa hai phần tử kề (Count Sign Changes Between Adjacent Elements)
Đếm số lần đổi dấu giữa hai phần tử kề (Count Sign Changes Between Adjacent Elements)
Count Sign Changes Between Adjacent Elements (Đếm số lần đổi dấu giữa hai phần tử kề)
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given , an adjacent pair for is a sign change exactly when one value is negative and the other is positive:
Equivalently, . If either value is zero, the pair is not counted. Count all such adjacent sign changes.
Input
The first line contains . The second line contains integers .
Output
Print the number of adjacent sign changes.
Subtask
Subtask 1 (20 points): , .
Subtask 2 (30 points): , .
Subtask 3 (50 points): , .
Example
Input
8
-2 5 0 -3 4 -1 -1 6
Output
4
Explanation
The sample follows the mathematical definition above.