#include<stdio.h> void main(){ int q,all,n,s; while(scanf("%d",&n)!=EOF){ all=0; q=0; while(n--){ scanf("%d",&s); if(s>0) all=all+s/2; else all=all+s; if(all<0) q++; } printf("%d\n",q); } }