#include <stdio.h>
int main()
{
int n,i,a,sum;
while(scanf("%d",&n)!=EOF)
{
int luck=0;
int sum=0;
for(i=1;i<=n;i++)
{
scanf("%d",&a);
if(a>0)
luck+=a/2;
else
luck+=a;
if(luck<0)
sum+=1;
}
printf("%d\n",sum);
}
return 0;
}