#include<stdio.h>
int main(){
int a,b,c;
int aa[99999];
while(~scanf("%d",&a)){
int bb=0;
int cc=0;
for(b=0;b<a;b++){
scanf("%d",&aa[b]);
}
bb=aa[0];
if(bb<0){
cc++;
}
else bb=aa[0]/2.0;
for(c=1;c<a;c++){
if(aa[c]<0){
bb=bb+aa[c];
if(bb<0)cc++;
}
else{
bb=bb+aa[c]/2.0;
if(bb<0)cc++;
}
}
printf("%d\n",cc);
}
}