#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main()
{
double k;
int n;
while(scanf("%d",&n)!=EOF)
{
double s = 0;
int p = 0;
while(n--)
{
scanf("%lf",&k);
if(k > 0)
s = s + (k/2);
else
s = s + k;
if(s < 0)
p++;
}
printf("%d\n",p);
}
return 0;
}