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