#include<stdio.h>
#include<math.h>
#include<string.h>
int main (){
int a[1000],b,i,c,d;
while(scanf("%d",&b)!=EOF){
for(i=0,c=0,d=0;i<b;i++)
{scanf("%d",&a[i]);
if(a[i]>0)
c=c+(0.5)*a[i];
else
c=c+a[i];
if(c<0)
d++;}
printf("%d\n",d);}
return 0;}