#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
int n;
while(cin >> n)
{
int ans=0;
double now=0;
for (int i=0;i<n;i++)
{
int tmp;
cin >> tmp;
now+= tmp>0 ? tmp/2.0 : tmp;
if (now<0)
ans++;
}
cout << ans << endl;
}
}