#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int N,i,a[11111];
while(scanf("%d",&N)!=EOF)
{
int count=0;
int ans=0;
for(i=0;i<N;++i)
{
scanf("%d",&a[i]);
if(a[i]<0)
{
ans+=a[i];
}
if(a[i]>0)
{
ans+=(a[i]/2);
}
if(ans<0)
count++;
}
printf("%d\n",count);
}
}