#include<stdio.h>
int main()
{
int n;
double number[10000];
while(scanf("%d",&n)!=EOF){
int i,count=0;
double num=0;
for(i=0;i<n;i++){
scanf("%lf",&number[i]);
}
for(i=0;i<n;i++){
if(number[i]>0){
num=num+number[i]/2;
}else{
num=num+number[i];
}
if(num<0){
count++;
}
}
printf("%d\n",count);
}
return 0;
}