#include<stdio.h>
#include<math.h>
int main(){
int a,b,c,e;
float d;
int m[100000];
while(scanf("%d",&a)!=EOF){
d=0;
e=0;
for(b=0;b<a;++b){
scanf("%d",&m[b]);
if(m[b]>=0){
d=d+m[b]*0.5;
}
else if(m[b]<0){
d=d+m[b];
}
if(d<0){
e++;
}
}
printf("%d\n",e);
}
return 0;
}