#include <bits/stdc++.h>
using namespace std;
int scan_int() {
  int x;
  if (!scanf("%d", &x)) throw 1;
  return x;
}
int main() {
  int N = scan_int();
  vector<int> A(N);
  for (auto& x : A) x = scan_int();
  vector<int> res(N, -1);
  vector<bool> used(N + 10);
  if (A[0] == 1) {
    res[0] = 0;
    used[0] = true;
  }
  for (int i = 1; i < N; ++i)
    if (A[i] != A[i - 1]) {
      res[i] = A[i - 1];
      used[A[i - 1]] = true;
    }
  used[A[N - 1]] = true;
  int p = 0;
  for (int i = 0; i < N; ++i) {
    if (res[i] == -1) {
      while (used[p]) ++p;
      used[p] = true;
      res[i] = p;
    }
  }
  for (int i = 0; i < N; ++i) {
    if (i) printf(" ");
    printf("%d", res[i]);
  }
  puts("");
}
