#include<bits/stdc++.h> using namespace std; int main (){ int n,s,a,sum; while(cin>>n){ sum=0; s=0; for(int i=0;i<n;++i){ cin>>a; if(a>0) a/=2; s+=a; if(s<0) ++sum; } cout<<sum<<endl; } return 0; }