#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 31;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long q;
  cin >> q;
  vector<long long> sums(MAXN);
  vector<multiset<long long> > nums(MAXN);
  long long cnt = 0;
  while (q--) {
    char type;
    cin >> type;
    if (type == '+') {
      long long num;
      cin >> num;
      cnt++;
      long long l = 1, r = 2;
      for (long long j = 0; j < MAXN; j++) {
        if (l <= num && num < r) {
          sums[j] += num;
          nums[j].insert(num);
          break;
        }
        l <<= 1, r <<= 1;
      }
      long long sum = 0, ans = 0;
      for (long long j = 0; j < MAXN; j++) {
        if (nums[j].size() == 0) continue;
        if (*nums[j].begin() > 2 * sum) ans++;
        sum += sums[j];
      }
      cout << cnt - ans << '\n';
    } else {
      long long num;
      cin >> num;
      cnt--;
      long long l = 1, r = 2;
      for (long long j = 0; j < MAXN; j++) {
        if (l <= num && num < r) {
          sums[j] -= num;
          nums[j].erase(nums[j].find(num));
          break;
        }
        l <<= 1, r <<= 1;
      }
      long long sum = 0, ans = 0;
      for (long long j = 0; j < MAXN; j++) {
        if (nums[j].size() == 0) continue;
        if (*nums[j].begin() > 2 * sum) ans++;
        sum += sums[j];
      }
      cout << cnt - ans << '\n';
    }
  }
  return 0;
}
