#include<stdio.h> #include<math.h> int main(){ int a,b,c,aa,bb; while(scanf("%d",&a)!=EOF){ aa=0;bb=0; for(b=0;b<a;b++){ scanf("%d",&c); if(c>0)c=c*0.5; aa=aa+c; if(aa<0)bb++; } printf("%d\n",bb); } return 0; }