#include <stdio.h>
int main(){
int n,i,count,total;
while(scanf("%d",&n)!=EOF){
count=0;
total=0;
while(n--){
scanf("%d",&i);
if(i<0){
count+=i;
}
else
count+=i/2;
if(count<0)
total++;
}
printf("%d\n",total);
}
return 0;
}