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