EasyRating 900
Police on Duty
Events happen in order. A positive number means that many officers are hired. -1 means a crime happens; a free officer handles it, otherwise it goes untreated. Each officer handles one crime. Count untreated crimes.
Input
n, then n integers.
Output
The count.
Sample 1
Input
3 -1 -1 1
Output
2
Sample 2
Input
8 1 -1 1 -1 -1 1 1 1
Output
1
Output appears here