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