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