#include<stdio.h> int main(){ int n; while(scanf("%d",&n)!=EOF){ int c=0; double a,b,s=0; while(n--){ scanf("%lf",&a); if(a>0) b=a/2; else b=a; s+=b; if(s<0) c++;} printf("%d\n",c); } return 0; }