#include<iostream>
#include<cmath>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
int n,s0=0;
double s=0;
int a[10000];
while(scanf("%d",&n)!=EOF){
s=0;
s0=0;
for(int i=0;i<n;++i){
scanf("%d",&a[i]);
}
for(int i=0;i<n;++i){
if(a[i]>0){
s+=a[i]/2.0;
}
else
s+=a[i];
if(s<0) ++s0;
}
printf("%d\n",s0);
}
return 0;
}