#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  std::vector<int> p(N, 0);
  for (size_t i = 0; i < N; i++) {
    cin >> p[i];
  }

  // main procedure
  set<int> rs;  // remain_setN
  for (size_t i = 0; i <= N + 1; i++) {
    rs.insert(i);
  }

  std::vector<int> ans(N, 0);
  for (size_t i = 0; i < N; i++) {
    rs.erase(p[i]);
    ans[i] = *(rs.begin());
  }

  // output
  for (size_t i = 0; i < N; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<bool> a(n, false);
    int r = 0;
    for (int i = 0; i < n; i++) {
        int p;
        cin >> p;
        if (p >= 0 && p < n) {
            a[p] = true;
        }
        while (r < n && a[r]) {
            r++;
        }
        cout << r << endl;
    }
}
