#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n,a;
while(cin>>n)
{
int sum1=0,k=0;
while(n--)
{
cin>>a;
if(a>0) sum1+=(a/2);
if(a<0) sum1+=a;
if(sum1<0) k+=1;
}
cout<<k<<endl;
}
//system("pause");
}