#include<cstdio>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
int n,z;
double sum=0,x;
while(cin>>n){
z=0;
sum=0;
for(int i=0;i<n;i++){
cin>>x;
if(x>0) sum+=x/2;
else
sum+=x;
if(sum<0)
z++;
}
cout<<z<<endl;
}
//system("pause");
return 0;
}