#include<stdio.h> int main() { int n,a,sum=0,c=0; while(scanf("%d",&n)!=EOF){ while(n--) { scanf("%d",&a); if(a>0){ sum+=a/2;} else { sum+=a;} if(sum<0) c+=1;} printf("%d\n",c); sum=0; c=0;} return 0; }