#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma GCC optimize(3)
template <typename T>
T min(T x, T y) {
  return x < y ? x : y;
}
template <typename T>
T max(T x, T y) {
  return x > y ? x : y;
};
struct tree {
  int l;
  int r;
  int tag;
  int mn;
  tree *lson;
  tree *rson;
  tree() {
    l = r = 0;
    tag = mn = 0;
    lson = rson = NULL;
  }
  void build(int L, int R) {
    l = L;
    r = R;
    if (l == r) return;
    int mid = (l + r) / 2;
    lson = new tree;
    rson = new tree;
    lson->build(l, mid);
    rson->build(mid + 1, r);
  }
  void ADD(int k) {
    tag += k;
    mn += k;
  }
  void pushdown() {
    if (tag) {
      lson->ADD(tag);
      rson->ADD(tag);
      tag = 0;
    }
  }
  void fixup() { mn = min(lson->mn, rson->mn); }
  void update(int L, int R, int k) {
    if (l >= L && r <= R) {
      ADD(k);
      return;
    }
    pushdown();
    int mid = (l + r) / 2;
    if (L <= mid) lson->update(L, R, k);
    if (R > mid) rson->update(L, R, k);
    fixup();
  }
  int query(int id) {
    if (r < id || mn > 0) return 0;
    if (l == r) return l;
    pushdown();
    int t = lson->query(id);
    return t ? t : rson->query(id);
  }
  int access(int id) {
    if (l == r) return mn;
    pushdown();
    int mid = (l + r) / 2;
    return id <= mid ? lson->access(id) : rson->access(id);
  }
};
const int MAXN = 500005;
int N, ans;
int a[MAXN], id[MAXN];
tree T;
std::set<int> S[3];
void solve() {
  for (int i = 1; i <= N; i++) {
    int t = T.access(id[i]);
    if (t == 0) {
      S[1].insert(id[i]);
      printf("%d\n", ans);
    } else if (t < 0) {
      S[0].insert(id[i]);
      int last = *(--S[0].end());
      if (last != id[i] && T.access(last) == 0) {
        T.update(id[i], last - 1, 1);
        S[0].erase(last);
        S[1].insert(last);
      } else if (S[1].size()) {
        int first = *S[1].begin();
        T.update(id[i], first - 1, 1);
        S[1].erase(first);
        S[2].insert(first);
      } else {
        T.update(id[i], N, 1);
        ans--;
      }
      printf("%d\n", ans);
    } else {
      S[2].insert(id[i]);
      int first = T.query(id[i]);
      if (first) {
        T.update(id[i], first - 1, -1);
        S[2].erase(first);
        S[1].insert(first);
      } else {
        T.update(id[i], N, -1);
        ans++;
      }
      printf("%d\n", ans);
    }
  }
}
bool cmp(int x, int y) { return a[x] < a[y]; }
int temp[MAXN];
void init() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", a + i);
    temp[i] = id[i] = i;
  }
  std::sort(temp + 1, temp + N + 1, cmp);
  for (int i = 1; i <= N; i++) id[temp[i]] = i;
  T.build(1, N);
  for (int i = 1; i <= N; i++) T.update(id[i], id[i], a[i]);
}
int main() {
  init();
  solve();
  return 0;
}
