#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, ans = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return f * ans;
}
const int MAXN = 1e6 + 11;
const int L = -5e5;
const int R = 5e5;
struct Segment1 {
  int Minn[MAXN << 2], tag[MAXN << 2];
  void build(int k, int l, int r) {
    if (l == r) {
      Minn[k] = l;
      return;
    }
    int mid = (l + r) >> 1;
    build(k << 1, l, mid), build(k << 1 | 1, mid + 1, r);
    Minn[k] = min(Minn[k << 1], Minn[k << 1 | 1]);
    return;
  }
  void pushdown(int k) {
    if (!tag[k]) return;
    Minn[k << 1] += tag[k], Minn[k << 1 | 1] += tag[k];
    tag[k << 1] += tag[k], tag[k << 1 | 1] += tag[k];
    tag[k] = 0;
    return;
  }
  void Modify(int k, int l, int r, int x, int y, int w) {
    if (x <= l && r <= y) {
      tag[k] += w, Minn[k] += w;
      return;
    }
    int mid = (l + r) >> 1;
    pushdown(k);
    if (x <= mid) Modify(k << 1, l, mid, x, y, w);
    if (mid < y) Modify(k << 1 | 1, mid + 1, r, x, y, w);
    Minn[k] = min(Minn[k << 1], Minn[k << 1 | 1]);
    return;
  }
  int Query(int k, int l, int r, int x, int y) {
    if (x <= l && r <= y) return Minn[k];
    int mid = (l + r) >> 1, res = INT_MAX;
    pushdown(k);
    if (x <= mid) res = min(res, Query(k << 1, l, mid, x, y));
    if (mid < y) res = min(res, Query(k << 1 | 1, mid + 1, r, x, y));
    Minn[k] = min(Minn[k << 1], Minn[k << 1 | 1]);
    return res;
  }
} S;
struct Segment2 {
  int Sum[MAXN << 2];
  void Modify(int k, int l, int r, int ps, int w) {
    if (l == r) {
      Sum[k] += w;
      return;
    }
    int mid = (l + r) >> 1;
    if (ps <= mid) Modify(k << 1, l, mid, ps, w);
    if (mid < ps) Modify(k << 1 | 1, mid + 1, r, ps, w);
    Sum[k] = Sum[k << 1] + Sum[k << 1 | 1];
    return;
  }
  int Query(int k, int l, int r, int x, int y) {
    if (x <= l && r <= y) return Sum[k];
    int res = 0, mid = (l + r) >> 1;
    if (x <= mid) res += Query(k << 1, l, mid, x, y);
    if (mid < y) res += Query(k << 1 | 1, mid + 1, r, x, y);
    return res;
  }
  int Find(int k, int l, int r, int kth) {
    if (l == r) return l;
    int mid = (l + r) >> 1;
    if (Sum[k << 1] < kth)
      return Find(k << 1 | 1, mid + 1, r, kth - Sum[k << 1]);
    return Find(k << 1, l, mid, kth);
  }
} T;
int Q, all, Minn = INT_MAX;
void ins(int x) {
  S.Modify(1, L, R, x, R, -1);
  T.Modify(1, L, R, x, 1);
  all++;
  Minn = min(Minn, x);
  return;
}
int Query(int ps, int F) {
  int cnt = T.Query(1, L, R, ps, R),
      Minn = min(F, S.Query(1, L, R, ps, R) + (all - cnt));
  return cnt + Minn;
}
int Sta[MAXN];
int main() {
  S.build(1, L, R);
  Q = read();
  while (Q--) {
    int x = read();
    ins(x);
    if (Minn >= 0) {
      printf("%d\n", Query(0, 0));
      continue;
    }
    int l = 1, r = all, res = INT_MAX;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (T.Find(1, L, R, mid) <= -mid)
        res = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    if (res == INT_MAX || res == all) {
      printf("%d\n", -all);
      continue;
    }
    int Kth = T.Find(1, L, R, res + 1);
    printf("%d\n", Query(Kth, -res));
  }
}
