#include<stdio.h> int main(){ int n,x,y=0,z=0; while(scanf("%d",&n)!=EOF){ while(n--){ scanf("%d",&x); if(x>0) y+=x/2; else y+=x; if(y<0) z+=1; else z+=0;} printf("%d\n",z); y=0; z=0; } return 0; }