Count Positive Prefix Sums
Count how many running totals stay strictly positive.
Input format
The first line has one integer N. The second line has N space-separated integers.
Output format
Read left to right keeping a running total. Print how many of the running totals (one after each element) are strictly greater than 0.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
5
1 -2 3 4 -10Expected output
3Example 2
Input
4
1 1 1 1Expected output
4