#include<stdio.h>
int n;
int main(){
double xingyunzhi,bushu,sum,qiuzhangzhi;
while(scanf("%d",&n)!=EOF){
qiuzhangzhi=0;
sum=0;
for(int i=0;i<n;i++){
scanf("%lf",&xingyunzhi);
if(xingyunzhi>=0){
xingyunzhi=xingyunzhi/2*1.0;
sum=sum+xingyunzhi;
}
if(xingyunzhi<0){
sum=sum+xingyunzhi;
}
if (sum<0){
qiuzhangzhi++;
}
}
printf ("%.0lf\n",qiuzhangzhi);
}
return 0;
}