#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
const int maxn = 100010;
const int inf = 0x3f3f3f3f;
const int modu = 1e9+7;
int n,m,k,t,ans,sum;
int a[maxn],vis[maxn];
vector<int> v[30];
string s;
int main(){
while(scanf("%d",&n)!=EOF){
ans=0;
sum=0;
for(int i=0;i<n;i++){
cin>>k;
if(k>0) sum+=k/2;
else sum+=k;
if(sum<0) ans++;
}
cout<<ans<<endl;
}
return 0;
}