#include<stdio.h>
int main()
{
int n,a[100002],i;
double total;
int t;
while(scanf("%d",&n)!=EOF)
{
total=0;
t=0;
for(i=1;i<=n;++i)
{
scanf("%d",&a[i]);
}
for(i=1;i<=n;++i)
{
if(a[i]<0)
{
total=total+a[i];
}
else
{
total=total+(a[i]*1.0/2);
}
if(total<0)
t++;
}
printf("%d\n",t);
}
}