#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
int sum=0,summ=0;
int a[100002];
while(scanf("%d",&n)!=EOF){
sum=0;
summ=0;
for(int i=0;i<n;++i){
cin>>a[i];
}
for(int i=0;i<n;++i){
if(a[i]<0){
sum+=a[i];
}
else if(a[i]>=0){
sum+=(a[i]/2);
}
if(sum<0) summ++;
}
cout<<summ<<endl;
}
}