#include <stdio.h>
#include <math.h>
int main(){
int n,step,sum=0,qzz=0;
while(scanf("%d",&n)!=EOF){
sum=0;
qzz=0;
getchar();
while(n>0){
scanf("%d",&step);
if(step>0){
step=step/2;
}
sum=sum+step;
if(sum<0){
qzz+=1;
}
n--;
}
printf("%d\n",qzz);
}
return 0;
}