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