#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main(){
int n,num,temp;
float lucky;
while(scanf("%d",&n)!=EOF){
num = 0;
lucky=0;
while(n--){
scanf("%d",&temp);
if(temp<0){
lucky += temp;
}else{
lucky += temp*0.5;
}
if(lucky<0){
num++;
}
}
printf("%d\n",num);
}
}