#include<stdio.h>
int main(){
int T;
int luckyPoint,n;
int total,ans;
while(scanf("%d",&n)!=EOF){
total=0;
ans=0;
while(n--){
scanf("%d",&luckyPoint);
if(luckyPoint>0){
luckyPoint=luckyPoint/2;
total+=luckyPoint;
}
else{
total+=luckyPoint;
}
if(total<0)
ans+=1;
}
printf("%d\n",ans);
}
return 0;
}