#include <bits/stdc++.h>
using namespace std;
const int maxq = 500002;
const int maxx = 1000000000;
struct node {
  union {
    struct {
      node *ls, *rs;
    };
    node *ch[2];
  };
  node *prt;
  int x, cnt;
  long long d;
};
node *create(int x);
node *init();
void update(node *p);
bool relation(node *p);
void rotate(node *p);
void splay(node *p, node *goal = NULL);
node *find_prv(int x);
node *find_pst(int x);
void insert(int x);
void remove(int x);
long long query(int l, int r);
int cal();
node *rt;
int cnt;
int main() {
  int q;
  rt = init();
  scanf("%d", &q);
  while (q--) {
    char c;
    scanf("%c", &c);
    while (c != '-' && c != '+') scanf("%c", &c);
    int x;
    scanf("%d", &x);
    if (c == '+') {
      cnt++;
      insert(x);
    } else {
      cnt--;
      remove(x);
    }
    int ans = cal();
    printf("%d\n", ans);
  }
  return 0;
}
node *create(int x) {
  static node pool[maxq];
  static node *p = pool;
  p->ls = p->rs = p->prt = NULL;
  p->x = x;
  p->cnt = 0;
  p->d = 0;
  return p++;
}
node *init() {
  node *p = create(0);
  p->rs = create(maxx + 1);
  p->rs->prt = p;
  update(p);
  return p;
}
void update(node *p) {
  p->d = (long long)p->cnt * p->x;
  if (p->ls) p->d += p->ls->d;
  if (p->rs) p->d += p->rs->d;
}
bool relation(node *p) { return p == p->prt->rs; }
void rotate(node *p) {
  bool rel = relation(p);
  if (p->prt->prt) p->prt->prt->ch[relation(p->prt)] = p;
  p->prt->ch[rel] = p->ch[!rel];
  if (p->ch[!rel]) p->ch[!rel]->prt = p->prt;
  p->ch[!rel] = p->prt;
  p->prt = p->prt->prt;
  p->ch[!rel]->prt = p;
  update(p->ch[!rel]);
  update(p);
}
void splay(node *p, node *goal) {
  while (p->prt != goal) {
    if (p->prt->prt == goal) {
      rotate(p);
      break;
    }
    if (relation(p) == relation(p->prt)) {
      rotate(p->prt);
      rotate(p);
    } else {
      rotate(p);
      rotate(p);
    }
  }
}
node *find_prv(int x) {
  node *ans = NULL;
  node *p = rt;
  while (p) {
    if (p->x < x) {
      ans = p;
      p = p->rs;
    } else
      p = p->ls;
  }
  return ans;
}
node *find_pst(int x) {
  node *ans = NULL;
  node *p = rt;
  while (p) {
    if (p->x > x) {
      ans = p;
      p = p->ls;
    } else
      p = p->rs;
  }
  return ans;
}
void insert(int x) {
  rt = find_prv(x);
  splay(rt);
  splay(find_pst(x), rt);
  if (!rt->rs->ls) {
    rt->rs->ls = create(x);
    rt->rs->ls->prt = rt->rs;
  }
  rt->rs->ls->cnt++;
  update(rt->rs->ls);
  update(rt->rs);
  update(rt);
}
void remove(int x) {
  rt = find_prv(x);
  splay(rt);
  splay(find_pst(x), rt);
  rt->rs->ls->cnt--;
  update(rt->rs->ls);
  if (!rt->rs->ls->cnt) rt->rs->ls = NULL;
  update(rt->rs);
  update(rt);
}
long long query(int l, int r) {
  rt = find_prv(l);
  splay(rt);
  splay(find_pst(r), rt);
  if (!rt->rs->ls) return 0;
  return rt->rs->ls->d;
}
int cal() {
  int ans = cnt;
  long long sum = 0;
  node *nnxt = find_pst(sum);
  while (nnxt = find_pst(sum), nnxt->x <= maxx) {
    long long cur = sum;
    long long nxt = nnxt->x;
    ans--;
    while (cur < nxt) {
      long long add = query(cur + 1, nxt);
      if (!add) break;
      sum += add;
      cur = min(nxt, (long long)maxx);
      nxt = min(2 * sum, (long long)maxx);
    }
    if (sum > maxx) break;
  }
  return ans;
}
