#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
int ans = 0;
double sum = 0;
for (int i = 0; i < n; i++)
{
double t;
cin >> t;
if (t < 0)
sum += t;
else
sum += (t / 2);
if (sum < 0)
ans++;
//printf("sum:%lf\n", sum);
}
printf("%d\n", ans);
}
return 0;
}