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