#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn = 200010;
const int inf = 0x3f3f3f3f;
int x, y, n, k, m;
int main()
{
while (scanf("%d", &n) != EOF)
{
ll ans = 0;
m = 0;
while(n--)
{
scanf("%d", &x);
if (x >= 0)m += (x) / 2;
else m += x;
if (m < 0)++ans;
}
printf("%d\n", ans);
}
return 0;
}