#include <bits/stdc++.h>
using namespace std;
int n, m;
int A[500006], bf[500006], ff[500006], bc[500006];
vector<pair<int, int> > op, fk;
struct fu {
  int T[500006 << 2], lz[500006 << 2], S[500006 << 2];
  void pu(int rt) { T[rt] = max(T[rt << 1], T[rt << 1 | 1]); }
  void ad(int rt, int c) { T[rt] += c, lz[rt] += c, S[rt] += c; }
  void pd(int rt) {
    if (lz[rt]) ad(rt << 1, lz[rt]), ad(rt << 1 | 1, lz[rt]), lz[rt] = 0;
  }
  void ads(int rt, int l, int r, int R, int c) {
    if (R >= r) {
      ad(rt, c);
      return;
    }
    pd(rt);
    int m = l + r >> 1;
    if (R <= m)
      ads(rt << 1, l, m, R, c);
    else
      ad(rt << 1, c), ads(rt << 1 | 1, m + 1, r, R, c);
    pu(rt);
  }
  pair<int, int> gt(int rt, int l, int r) {
    if (l == r) return make_pair(S[rt], l);
    pd(rt);
    int m = l + r >> 1;
    if (T[rt << 1] >= 0) return gt(rt << 1, l, m);
    return gt(rt << 1 | 1, m + 1, r);
  }
  void sp(int rt, int l, int r, int p, int c) {
    if (l == r) {
      T[rt] = c + S[rt];
      return;
    }
    pd(rt);
    int m = l + r >> 1;
    if (p <= m)
      sp(rt << 1, l, m, p, c);
    else
      sp(rt << 1 | 1, m + 1, r, p, c);
    pu(rt);
  }
  int qmn(int rt, int l, int r, int L) {
    if (L <= l) return T[rt];
    pd(rt);
    int m = l + r >> 1;
    if (L <= m) return max(T[rt << 1 | 1], qmn(rt << 1, l, m, L));
    return qmn(rt << 1 | 1, m + 1, r, L);
  }
  void build() {
    memset(T, -0x3f, sizeof T);
    memset(lz, 0, sizeof lz), memset(S, 0, sizeof S);
  }
} T1, T2;
int kas = 0;
void solve() {
  ++kas;
  cin >> n;
  op.clear(), fk.clear();
  for (int i = (1), iend = (n); i <= iend; ++i) {
    scanf("%d", A + i);
    if (A[i] > 0)
      op.emplace_back(A[i], i);
    else
      fk.emplace_back(-A[i], -i), op.emplace_back(A[i], i);
  }
  int s = op.size(), f = fk.size();
  sort((op).begin(), (op).end()), sort((fk).begin(), (fk).end());
  for (int i = (1), iend = (s); i <= iend; ++i) {
    bc[op[i - 1].second] = i;
  }
  int pr = s;
  for (int i = (1), iend = (s); i <= iend; ++i)
    if (op[i - 1].first > 0) {
      pr = i - 1;
      break;
    }
  for (int i = (1), iend = (f); i <= iend; ++i)
    fk[i - 1].second = -fk[i - 1].second, bf[fk[i - 1].second] = i,
           ff[i] = fk[i - 1].second;
  T1.build(), T2.build();
  int ini = 0, ps = 0, ts = 0;
  for (int i = (1), iend = (n); i <= iend; ++i) {
    if (A[i] <= 0) {
      T1.sp(1, 1, f, bf[i], -A[i]);
      T1.ads(1, 1, f, bf[i], -1);
      if (T1.T[1] < 0)
        ini = 0, ps = pr + 1;
      else {
        pair<int, int> t = T1.gt(1, 1, f);
        ini = -t.first;
        ps = t.second;
      }
    }
    T2.sp(1, 1, s, bc[i], -A[i]);
    if (bc[i] > 1) T2.ads(1, 1, s, bc[i] - 1, -1);
    printf("%d\n", min(-T2.qmn(1, 1, s, pr - ps + 2), -ini + i - ini));
  }
}
signed main() { solve(); }
