#include <bits/stdc++.h>
const int N = 500005, inf = 0x3f3f3f3f;
int n, a[N];
std::pair<int, int> b[N];
struct data {
  int sum, min;
  data() { sum = 0, min = inf; }
  data(int s, int m) : sum(s), min(m) {}
  friend data operator+(data a, data b) {
    return (data){a.sum + b.sum, std::min(a.min + b.sum, b.min)};
  }
} val[N << 2];
void pushup(int o) { val[o] = val[o << 1] + val[o << 1 | 1]; }
void modify(int x, int y, int o = 1, int l = 1, int r = n) {
  if (l == r) {
    val[o] = data(1, y);
    return;
  }
  int mid = l + r >> 1;
  if (x <= mid)
    modify(x, y, o << 1, l, mid);
  else
    modify(x, y, o << 1 | 1, mid + 1, r);
  pushup(o);
}
data query(int pos, int o = 1, int l = 1, int r = n) {
  if (pos <= l) return val[o];
  if (pos > r) return data();
  int mid = l + r >> 1;
  return query(pos, o << 1, l, mid) + query(pos, o << 1 | 1, mid + 1, r);
}
int max[N], s[N];
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0);
  std::cin >> n;
  for (int i = 1; i <= n; ++i)
    std::cin >> a[i], b[i] = std::pair<int, int>(a[i], i);
  std::sort(b + 1, b + n + 1);
  for (int i = 1; i <= n; ++i)
    a[i] = std::lower_bound(b + 1, b + n + 1, std::pair<int, int>(a[i], i)) - b;
  for (int i = 1; i <= n; ++i) max[i] = -inf;
  for (int i = 1; i <= n; ++i) {
    modify(a[i], b[a[i]].first);
    for (int j = a[i]; j <= n; j += j & -j)
      ++s[j], max[j] = std::max(max[j], b[a[i]].first);
    int l = 1, r = n, ans = 0;
    auto check = [&](int mid) {
      int a = 0, b = -inf;
      for (int i = mid; i; i &= i - 1) a += s[i], b = std::max(b, max[i]);
      return b <= -a;
    };
    while (l <= r) {
      int mid = l + r >> 1;
      if (check(mid))
        ans = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    int A = 0, rem = i;
    for (int j = ans; j; j &= j - 1) A += s[j], rem -= s[j];
    std::cout << std::min(rem - A, query(ans + 1).min) << '\n';
  }
  return 0;
}
