#include<cstdio>
#include <algorithm>
#include <iostream>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn=110;
int main()
{
int n,i,a,ans,sum;
while(~scanf("%d",&n))
{
sum=0;ans=0;
for(i=1;i<=n;i++)
{
scanf("%d",&a);
if(a>0){a=a/2;}
sum+=a;
if(sum<0){ans++;}
}
printf("%d\n",ans);
}
// system("pause");
}