#include <bits/stdc++.h>
using namespace std;
struct op {
  char t;
  int val;
  int del_idx;
  int seg_ind;
};
op q[500500];
int n;
map<int, vector<int>> g;
pair<int, int> sr[500500];
int m = 0;
long long sgt[2002002];
void update(int nd, int l, int r, int ind, int val) {
  if (l == r) {
    sgt[nd] = val;
    return;
  }
  int mid = (r + l) / 2;
  if (ind <= mid) {
    update(2 * nd, l, mid, ind, val);
  } else {
    update(2 * nd + 1, mid + 1, r, ind, val);
  }
  sgt[nd] = sgt[2 * nd] + sgt[2 * nd + 1];
}
long long query(int nd, int l, int r, int s, int e) {
  if (s <= l && r <= e) {
    return sgt[nd];
  }
  int mid = (r + l) / 2;
  long long ret = 0;
  if (s <= mid) {
    ret += query(2 * nd, l, mid, s, e);
  }
  if (mid + 1 <= e) {
    ret += query(2 * nd + 1, mid + 1, r, s, e);
  }
  return ret;
}
set<int> yy;
set<int>::iterator ii;
bool chk(int ind) {
  if (ind == 0) return false;
  long long s = query(1, 0, m - 1, 0, ind - 1);
  if (2 * s >= sr[ind].first) {
    return true;
  } else {
    return false;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf(" %c %d", &q[i].t, &q[i].val);
    if (q[i].t == '+') {
      g[q[i].val].push_back(i);
      sr[m++] = make_pair(q[i].val, i);
    } else {
      q[i].del_idx = g[q[i].val].back();
      g[q[i].val].pop_back();
    }
  }
  sort(sr, sr + m);
  for (int i = 0; i < m; i++) {
    q[sr[i].second].seg_ind = i;
  }
  yy.insert(m);
  sr[m].first = 1ll << 62;
  for (int i = 0; i < n; i++) {
    if (q[i].t == '+') {
      update(1, 0, m - 1, q[i].seg_ind, q[i].val);
      yy.insert(q[i].seg_ind);
    } else {
      int idd = q[q[i].del_idx].seg_ind;
      update(1, 0, m - 1, idd, 0);
      yy.erase(idd);
    }
    int sol = 0;
    int sz = yy.size();
    int cur = *yy.lower_bound(0);
    while (cur != m) {
      long long s = 0;
      if (cur > 0) {
        s = query(1, 0, m - 1, 0, cur - 1);
      }
      if (2 * s < sr[cur].first) {
        sol++;
      }
      int ll = cur, rr = m;
      s += sr[cur].first;
      while (rr - ll > 1) {
        int m = (rr + ll) / 2;
        if (sr[m].first <= 2 * s) {
          ll = m;
        } else {
          rr = m;
        }
      }
      cur = *yy.lower_bound(rr);
    }
    printf("%d\n", sz - sol - 1);
  }
}
