#include <bits/stdc++.h>   using namespace std;   long long Q;   long long sum[105];   multiset<long long> s;   int main() {     cin.tie(0);     ios_base::sync_with_stdio(0);     cin >> Q;     while (Q--) {       char op;       long long f;       cin >> op >> f;       if (op ==  + ) {         long long i = 0;         while ((1 << (i + 1)) <= f) i++;         sum[i] += f;         s.insert(f);       } else {         long long i = 0;         while ((1 << (i + 1)) <= f) i++;         sum[i] -= f;         s.erase(s.find(f));       }       long long t = s.size();       long long k = 0;       long long ant = 0;       for (long long i = 0; i <= 30; i++) {         ant += sum[i];         auto it = s.lower_bound((1 << i));         if (it == s.end()) continue;         if ((1 << (i + 1)) <= *it) continue;         if (*it > 2 * (ant - sum[i])) k++;       }       cout << t - k <<   n ;     }     return 0;   }   