#include<stdio.h> #include<string.h> int main(){ int n,q,luck,sum; while(~scanf("%d",&n)) { luck=0,q=0; for(int i=1;i<=n;i++){ scanf("%d",&sum); if(sum<0) luck+=sum; else luck+=sum/2; if(luck<0) q++; } printf("%d\n",q); } }