#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<deque>
#include<map>
#include<algorithm>
using namespace std;
deque<int> m;
map<string, int> x;
deque<pair<string, int>> r;
int main() {
int t;
while(cin >> t) {
int lunck = 0, num = 0;
while(t--) {
int n;
cin >> n;
if(n > 0)
n /= 2;
lunck += n;
if(lunck < 0)
num++;
}
cout << num;
if(t != 0)
cout << endl;
}
return 0;
}