#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10, M = 5e5 + 5;
int n, a[N], s[N];
void add(int first, int d) {
  for (; first < N; first += (-first) & first) s[first] += d;
}
int sum(int first) {
  int ans = 0;
  for (; first; first -= (-first) & first) ans += s[first];
  return ans;
}
int find(int a) {
  int first = 0, cur = 0;
  for (int j = 19; j >= 0; j--)
    if ((first | (1 << j)) < N &&
        (a - (cur + s[first | (1 << j)]) > (first | (1 << j))))
      first |= 1 << j, cur += s[first | (1 << j)];
  return first + 1;
}
const int inf = 1e9 + 10;
namespace seg {
int a, b, c;
int mn[N << 2], d[N << 2];
void build(int first, int l, int r) {
  mn[first] = inf, d[first] = 0;
  if (l < r)
    build((first << 1), l, ((l + r) >> 1)),
        build(((first << 1) | 1), ((l + r) >> 1) + 1, r);
}
void push(int first, int l, int r) {
  if (d[first]) {
    mn[first] += d[first];
    if (l < r) d[(first << 1)] += d[first], d[((first << 1) | 1)] += d[first];
    d[first] = 0;
  }
}
void add(int first, int l, int r) {
  if (a <= l && r <= b)
    d[first] += c, push(first, l, r);
  else
    (a <= ((l + r) >> 1) ? add((first << 1), l, ((l + r) >> 1))
                         : push((first << 1), l, ((l + r) >> 1))),
        (b > ((l + r) >> 1) ? add(((first << 1) | 1), ((l + r) >> 1) + 1, r)
                            : push(((first << 1) | 1), ((l + r) >> 1) + 1, r)),
        mn[first] = min(mn[(first << 1)], mn[((first << 1) | 1)]);
}
void modi(int first, int l, int r) {
  push(first, l, r);
  if (l == r)
    mn[first] = c;
  else
    (a <= ((l + r) >> 1) ? modi((first << 1), l, ((l + r) >> 1)),
     push(((first << 1) | 1), ((l + r) >> 1) + 1, r)
                         : modi(((first << 1) | 1), ((l + r) >> 1) + 1, r),
     push((first << 1), l, ((l + r) >> 1))),
        mn[first] = min(mn[(first << 1)], mn[((first << 1) | 1)]);
}
int qry(int first, int l, int r) {
  push(first, l, r);
  if (a <= l && r <= b)
    return mn[first];
  else
    return min(
        (a <= ((l + r) >> 1) ? qry((first << 1), l, ((l + r) >> 1)) : inf),
        (b > ((l + r) >> 1) ? qry(((first << 1) | 1), ((l + r) >> 1) + 1, r)
                            : inf));
}
}  // namespace seg
void Add(int first) {
  add(first, 1);
  seg::a = 1, seg::b = first - 1, seg::c = 1;
  seg::add(1, 1, N - 1);
  seg::a = first;
  seg::c = first + sum(N - 1) - sum(first), seg::modi(1, 1, N - 1);
}
int Qry(int first) {
  int t = find(first);
  seg::a = t + 1, seg::b = N - 1;
  return min(sum(N - 1) - sum(t) + t, seg::qry(1, 1, N - 1));
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i), a[i] += M;
  seg::build(1, 1, N - 1);
  for (int i = 1; i <= n; i++) {
    Add(a[i]);
    printf("%d\n", Qry(M) - M);
  }
  return 0;
}
