#include <cstdio>
#include <algorithm>
#include <iostream>
#include<cstring>
#include<cmath>
#include<time.h>
using namespace std;
int main()
{
int n,sum,a,ans;
while(~scanf("%d",&n))
{
sum=0;ans=0;
while(n--)
{
scanf("%d",&a);
if(a>0)a=a/2;
sum+=a;
if(sum<0)
{
ans++;
}
}
printf("%d\n",ans);
}
}