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