#include <bits/stdc++.h>
using namespace std;
const int maxn = 500000 + 10;
const int INF = 0x3f3f3f3f;
int n, a[maxn], pos[maxn], rt, tcnt;
struct tnode {
  int ls, rs, mn, sz;
  tnode() {}
  tnode(int val) {
    ls = rs = sz = 0;
    mn = INF;
  }
} t[maxn << 2];
pair<int, int> val[maxn];
inline void lsh() {
  for (int i = 1; i <= n; i++) val[i] = make_pair(a[i], i);
  sort(val + 1, val + n + 1);
  for (int i = 1; i <= n; i++) pos[val[i].second] = i;
}
struct qnode {
  int u, w;
  qnode() {}
  qnode(int _u, int _w) : u(_u), w(_w) {}
  friend bool operator<(qnode a, qnode b) {
    if (a.w != b.w) return a.w < b.w;
    return a.u < b.u;
  }
};
priority_queue<qnode> q;
inline void pushup(int u) {
  int ls = t[u].ls, rs = t[u].rs;
  if (!ls && !rs) return;
  if (!ls || !rs) {
    t[u].mn = t[ls + rs].mn;
    return;
  }
  t[u].mn = min(t[ls].mn + t[rs].sz, t[rs].mn);
}
void updata(int &u, int l, int r, int p, int q) {
  if (!u) {
    u = ++tcnt;
    t[u] = tnode(0);
  }
  t[u].sz++;
  if (l == r) {
    t[u].mn = q;
    return;
  }
  int mid = (l + r) >> 1;
  if (p <= mid)
    updata(t[u].ls, l, mid, p, q);
  else
    updata(t[u].rs, mid + 1, r, p, q);
  pushup(u);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  lsh();
  while (!q.empty()) q.pop();
  rt = tcnt = 0;
  int sz = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] < 0) {
      q.push(qnode(i, a[i]));
      sz++;
      while (!q.empty()) {
        qnode now = q.top();
        if (now.w >= -sz + 1) {
          q.pop();
          updata(rt, 1, n, pos[now.u], now.w);
          sz--;
        } else
          break;
      }
    } else
      updata(rt, 1, n, pos[i], a[i]);
    int Ans = min(-sz + t[1].sz, t[1].mn);
    printf("%d\n", Ans);
  }
  return 0;
}
