#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
int a[N], b[N], ex[N];
void solve() {
  int n;
  cin >> n;
  memset(b, -1, sizeof(b));
  for (int i = 1; i <= (int)(n); ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= (int)(n); ++i) {
    if (a[i] != a[i - 1]) {
      b[i] = a[i - 1];
      ex[b[i]] = 1;
    }
  }
  ex[a[n]] = 1;
  int m = 0;
  for (int i = 1; i <= (int)(n); ++i) {
    while (ex[m]) m++;
    if (b[i] == -1) {
      b[i] = m;
      ex[m] = 1;
    }
    cout << b[i] << " ";
  }
  cout << endl;
}
int main() {
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
