#include <stdio.h>
int main(){
int n,c;
double sum;
int a[100000];
while(scanf("%d",&n)!=EOF){
sum=0;
c=0;
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(int j=0;j<n;j++){
if(a[j]<=0){
sum=sum+a[j];
}else{
sum=(double)a[j]/2.0+sum;
}
if(sum<0){
c++;
}
}
printf("%d\n",c);
}
return 0;
}