#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
using namespace std;
typedef long long ll;
const int maxn = 1e4+7;
int main()
{
int n;
while(~scanf("%d",&n))
{
int x;
int tot = 0;
int ans = 0;
for(int i=0;i<n;i++)
{
scanf("%d",&x);
if(x > 0)
tot += x/2;
else
tot += x;
if(tot < 0)
ans++;
}
printf("%d\n",ans);
}
}