#include<stdio.h> int main(){ int i,j,n,m,k,a=0,b=0; while(scanf("%d",&n)!=EOF){ for(i=0;i<n;i++) { scanf("%d",&m); if(m>0) a=a+m*1.0/2; else a=a+m; if(a<0) b=b+1; } printf("%d\n",b); a=0,b=0; } }