#include<stdio.h>
#include<math.h>
int main(){
double n,m;
double s=0,t=0;
while(scanf("%lf",&n)!=EOF){
while(n--){
scanf("%lf",&m);
if(m>0){
s+=m/2;
}
else if(m<0)
s+=m;
if(s<0)
t+=1;
else
t+=0;
}
printf("%.0lf\n",t);
s=0,t=0;
}
}