#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool store[n + 1];
  int a[n + 1], b[n + 1];
  memset(b, -1, sizeof(b));
  memset(store, false, sizeof(store));
  a[0] = 0;
  b[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] != a[i - 1]) {
      b[i] = a[i - 1];
      store[b[i]] = true;
    }
  }
  store[a[n]] = true;
  int m = 0;
  for (int i = 1; i <= n; i++) {
    while (store[m]) m++;
    if (b[i] == -1) {
      b[i] = m;
      store[b[i]] = true;
    }
    cout << b[i] << " ";
  }
  return 0;
}
