#include<stdio.h> int main(){ int n,t,i,m,a1,a2; while(scanf("%d",&t)!=EOF){ a1=0,a2=0; for(i=0;i<t;i++){ scanf("%d",&m); if(m>0) a1=a1+m/2; else a1=a1+m; if(a1<0) a2=a2+1; } printf("%d\n",a2); } return 0; }