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