#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main(){
long long int n;
while(scanf("%lld", &n)!=EOF){
double a[n+10];
int i = 0;
int num = 0;
double sum = 0;
for(i = 0; i < n ; i++){
scanf("%lf", &a[i]);
if( a[i] > 0 ){
sum += (a[i]/2.0);
} else {
sum += a[i];
}
if(sum < 0){
num += 1;
}
}
printf("%d\n", num);
}
return 0;
}