#include<stdio.h> int main(){ int t,l,s,b; while(scanf("%d",&t)!=EOF){ l=0; s=0; while(t--){ scanf("%d",&b); if(b>0){ b=b/2.0; } s+=b; if(s<0){ l+=1; } } printf("%d\n",l); } return 0; }