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