#include<stdio.h>
int main(){
int n,i,sum=0,count=0,s,x;
while(scanf("%d",&n)!=EOF){
count=0;
s=0;sum=0;
for(x=0;x<n;x++){
scanf("%d",&i);
if(i>0){
i=i/2;
}
else if(i<=0){
i=i;
}
sum+=i;
if(sum<0){
count+=1;
}
else if(sum>=0){
count+=0;
}
}
s+=count;
printf("%d\n",s);
}
return 0;
}