#include <stdio.h>
int main(){
int n;
while(scanf("%d", &n)!=EOF){
double st, total, x, judg;
st = 0;
total = 0;
x = 0;
while(n--){
scanf("%lf", &st);
if(st>0)
x += st/2.0;
else
x += st;
if(x<0)
total += 1;
}printf("%.0f\n", total);
}
return 0;
}