#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main(){
int n;
while(scanf("%d",&n)!=EOF){
int a[10000]={0},i,count=0;
double z=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
if(a[i]>0){
z+=a[i]*0.5;
}
else
z+=a[i];
if(z<0)
count++;
}
printf("%d\n",count);
}
}