#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int b[n];
  int c[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    c[i] = 0;
    b[i] = -1;
    if (i > 0 && a[i] != a[i - 1]) {
      c[a[i - 1]] = 1;
      b[i] = a[i - 1];
    }
  }
  int r = 0;
  c[a[n - 1]] = 1;
  for (int i = 0; i < n; i++) {
    while (c[r] == 1) {
      r++;
    }
    if (b[i] == -1) {
      b[i] = r;
      c[r] = 1;
    }
    cout << b[i] << " ";
  }
}
