#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long n;
long long a[N], b[N];
bool ex[N];
void solve() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  memset(b, -1, sizeof(b));
  for (long long i = 1; i <= n; i++) {
    if (a[i] != a[i - 1]) {
      b[i] = a[i - 1];
      ex[b[i]] = true;
    }
  }
  ex[a[n]] = true;
  long long m = 0;
  for (long long i = 1; i <= n; i++) {
    while (ex[m]) m++;
    if (b[i] == -1) {
      b[i] = m;
      ex[m] = true;
    }
    cout << b[i] << ' ';
  }
}
signed main() {
  solve();
  return 0;
}
