The police department of your city has just started its journey. Initially, they don’t have any manpower. So, they started hiring new recruits in groups.

Meanwhile, crimes keeps occurring within the city. One member of the police force can investigate only one crime during his/her lifetime.

If there is no police officer free (isn't busy with crime) during the occurrence of a crime, it will go untreated.

Given the chronological order of crime occurrences and recruit hirings, find the number of crimes which will go untreated.
The first line of input will contain an integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>), the number of events. The next line will contain *n* space-separated integers.

If the integer is -1 then it means a crime has occurred. Otherwise, the integer will be positive, the number of officers recruited together at that time. No more than 10 officers will be recruited at a time.
#ogni numero positivo annulla un uno negativo, ogni volta che vi é un uno negativo che non trova chi annullarlo, un contatore
# conta, se il numero finale é positivo, it doesnt matter se invece é negativo it does matter. quindi
#creo un contatore che mette le carte positive a parte e le negative a parte, ma prende in considerazione lordine di esse,
#nel senso che se le positive vengono dopo le negative they dont matter. create an empty slot and each time it goes below zero it counts it as one, and if it adds up it adds up. it should start at zero

# creating an empty list
lst = []
# number of elements as input
n = int(input("Enter number of elements : "))
#the counter that restarts each time it goes below zero
x = int(0)
counter = int(0)
# iterating till the range
for i in range(0, n):
    ele = int(input())
    x = x+ele
    if (x < 0) :
        counter = counter+1
        x = 0
    # adding the element
    lst.append(ele)

#print(lst)
print(counter)
