#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
int n,a[100000],num=0,b=0;
while( scanf("%d",&n)!=EOF){
num=0;
b=0;
memset(a,0,sizeof a);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(int l=0;l<n;l++){
if(a[l]>=0)
num=num+a[l]/2;
else
num=num+a[l];
if(num<0)
b=b+1;
}
printf("%d\n",b);
}
}