#include <bits/stdc++.h>
using namespace std;
struct tree {
  int id;
  long long d, mi;
} f[500005 * 4];
struct node {
  int x, y, z;
} b[500005];
int q[500005], n, tot, r;
map<int, int> ma;
vector<int> A[500005], a;
set<int> G;
set<int>::iterator gt;
long long F[500005];
inline void change(int x, long long y) {
  for (; x <= r; x += x & -x) F[x] += y;
}
inline long long ask(int x) {
  long long s = 0;
  for (; x; x -= x & -x) s += F[x];
  return s;
}
inline bool cmp(int x, int y) { return b[x].y < b[y].y; }
inline void build(int o, int l, int r) {
  f[o].mi = 1000000000000000000ll;
  if (l == r) {
    f[o].id = q[l];
    return;
  }
  int mid = (l + r) >> 1;
  build((o << 1), l, mid), build(((o << 1) + 1), mid + 1, r);
}
inline void down(int o) {
  if (!f[o].d) return;
  f[(o << 1)].mi += f[o].d;
  f[(o << 1)].d += f[o].d;
  f[((o << 1) + 1)].mi += f[o].d;
  f[((o << 1) + 1)].d += f[o].d;
  f[o].d = 0;
}
inline void change(int o, int l, int r, int ll, long long p) {
  if (l == ll && r == ll) {
    f[o].mi = p;
    return;
  }
  down(o);
  int mid = (l + r) >> 1;
  if (ll <= mid)
    change((o << 1), l, mid, ll, p);
  else
    change(((o << 1) + 1), mid + 1, r, ll, p);
  f[o].mi = min(f[(o << 1)].mi, f[((o << 1) + 1)].mi);
}
inline void change(int o, int l, int r, int ll, int rr, int p) {
  if (ll > rr) return;
  if (l == ll && r == rr) {
    f[o].mi += p;
    f[o].d += p;
    return;
  }
  down(o);
  int mid = (l + r) >> 1;
  if (rr <= mid)
    change((o << 1), l, mid, ll, rr, p);
  else if (ll > mid)
    change(((o << 1) + 1), mid + 1, r, ll, rr, p);
  else
    change((o << 1), l, mid, ll, mid, p),
        change(((o << 1) + 1), mid + 1, r, mid + 1, rr, p);
  f[o].mi = min(f[(o << 1)].mi, f[((o << 1) + 1)].mi);
}
inline void ask(int o, int l, int r) {
  if (l == r) {
    if (f[o].mi < 0) G.insert(f[o].id), f[o].mi = 1000000000000000000ll;
    return;
  }
  down(o);
  int mid = (l + r) >> 1;
  if (f[(o << 1)].mi < 0) ask((o << 1), l, mid);
  if (f[((o << 1) + 1)].mi < 0) ask(((o << 1) + 1), mid + 1, r);
  f[o].mi = min(f[(o << 1)].mi, f[((o << 1) + 1)].mi);
}
int main() {
  scanf("%d", &n);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    char c = getchar();
    while (c != '+' && c != '-') c = getchar();
    if (c == '+')
      b[i].x = 1;
    else
      b[i].x = 0;
    scanf("%d", &b[i].y);
    if (b[i].x == 1) q[++r] = i;
  }
  sort(q + 1, q + 1 + r, cmp);
  for (int i = 1; i <= r; i++) b[q[i]].z = i;
  build(1, 1, r);
  for (int i = 1; i <= n; i++) {
    if (!ma[b[i].y]) ma[b[i].y] = ++tot;
    int Y = ma[b[i].y];
    if (b[i].x == 1) {
      A[Y].push_back(i);
      ans++;
      long long sum = ask(b[i].z);
      long long p = (b[i].y + 1) / 2;
      change(b[i].z, b[i].y);
      if (sum >= p) {
        change(1, 1, r, b[i].z, sum - p);
        change(1, 1, r, b[i].z + 1, r, b[i].y);
      } else {
        change(1, 1, r, b[i].z + 1, r, b[i].y);
        G.insert(i);
      }
      a.clear();
      for (gt = G.begin(); gt != G.end(); gt++) {
        int tmp = *gt;
        if (b[tmp].z <= b[i].z) continue;
        sum = ask(b[tmp].z - 1);
        p = (b[tmp].y + 1) >> 1;
        if (sum >= p) {
          a.push_back(tmp);
          change(1, 1, r, b[tmp].z, sum - p);
        }
      }
      for (int i = 0; i < a.size(); i++) G.erase(a[i]);
      printf("%d\n", ans - (int)G.size());
    } else {
      int x = *A[Y].begin();
      change(b[x].z, -b[x].y);
      A[Y].erase(A[Y].begin());
      change(1, 1, r, b[x].z + 1, r, -b[x].y);
      change(1, 1, r, b[x].z, 1000000000000000000ll);
      ask(1, 1, r);
      gt = G.find(x);
      if (gt != G.end()) G.erase(gt);
      ans--;
      printf("%d\n", ans - (int)G.size());
    }
  }
}
