#include <bits/stdc++.h>
using namespace std;
const int N = 514514;
int n, m, po, as, l, r, a[N], b[N], c[N];
int tr1[N], tr2[N];
int mn[N << 2], lz[N << 2];
int lb(int x) { return x & (-x); }
void add1(int x) {
  while (x) tr1[x]++, x -= lb(x);
}
void add2(int x) {
  while (x <= m) tr2[x]--, x += lb(x);
}
int ask1(int x) {
  int k = 0;
  while (x <= m) k += tr1[x], x += lb(x);
  return k;
}
int ask2(int x) {
  int k = 0;
  while (x) k += tr2[x], x -= lb(x);
  return k;
}
void build(int i, int l, int r) {
  if (l == r) {
    mn[i] = b[l];
    return;
  }
  build((i << 1), l, ((l + r) >> 1));
  build((i << 1 | 1), ((l + r) >> 1) + 1, r);
  mn[i] = min(mn[(i << 1)], mn[(i << 1 | 1)]);
}
void push(int i) {
  int k = lz[i];
  lz[i] = 0;
  mn[(i << 1)] += k, mn[(i << 1 | 1)] += k, lz[(i << 1)] += k,
      lz[(i << 1 | 1)] += k;
}
void add(int i, int l, int r, int s) {
  if (l >= s) {
    mn[i]--, lz[i]--;
    return;
  }
  push(i);
  if (((l + r) >> 1) >= s) add((i << 1), l, ((l + r) >> 1), s);
  add((i << 1 | 1), ((l + r) >> 1) + 1, r, s);
  mn[i] = min(mn[(i << 1)], mn[(i << 1 | 1)]);
}
int ask(int i, int l, int r, int s) {
  if (l >= s) return mn[i];
  int as = 1e9;
  push(i);
  if (((l + r) >> 1) >= s) as = ask((i << 1), l, ((l + r) >> 1), s);
  as = min(ask((i << 1 | 1), ((l + r) >> 1) + 1, r, s), as);
  return as;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  b[++n] = 0;
  sort(b + 1, b + n + 1);
  m = unique(b + 1, b + n + 1) - b - 1;
  po = lower_bound(b + 1, b + m + 1, 0) - b;
  build(1, 1, m);
  for (int i = 1, x; i < n; i++) {
    l = 1, r = po;
    x = lower_bound(b + 1, b + m + 1, a[i]) - b;
    c[x]++;
    add1(x);
    add2(x);
    add(1, 1, m, x);
    while (l <= r) {
      int md = (l + r) >> 1;
      if (ask2(md) <= b[md])
        as = md, r = md - 1;
      else
        l = md + 1;
    }
    int nw = ask2(as - 1);
    printf("%d\n", min(nw, ask(1, 1, m, as) - nw) + ask1(as));
  }
}
