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