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