#include<stdio.h>
#include<stdlib.h>
int main()
{
int i, n,result=0;
int t,l=0;
while(scanf("%d",&n)!=EOF)
{
result=0;l=0;
for(i=0;i<n;++i)
{
scanf("%d",&t);
l+=t<0?t:t/2;
result+=l<0?1:0;
}
printf("%d\n",result);
}
return 0;
}