#include<stdio.h> #include<math.h> int main(){ int n,m; while(scanf("%d",&n)!=EOF){ int s=0,h=0; while(n--){ scanf("%d",&m); if(m>0){s=s+0.5*m;} else{s=s+m;} if(s<0){h=h+1;}} printf("%d\n",h); } }