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