#include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
int num;
double sum=0;
int qiuzhangzhi=0;
while(scanf("%d",&n)!=EOF)
{
sum=0;
qiuzhangzhi=0;
while(n--)
{
scanf("%d",&num);
if(num<=0)
{
sum+=num;
}
else if(num>0)
{
if(num%2==0)
{
sum+=(num/2);
}
else
sum+=1.0*num/(2*1.0);
}
if(sum<0)
{
qiuzhangzhi++;
}
}
printf("%d\n",qiuzhangzhi);
}
}