#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n;
  cin >> n;
  vector<long long int> a;
  long long int k;
  for (long int i = 0; i < n; i++) {
    cin >> k;
    a.push_back(k);
  }
  map<int, int> covered;
  vector<long long int> b(n, -1);
  covered[a[n - 1]] = 1;
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) {
      b[i] = a[i - 1];
      covered[a[i - 1]] = 1;
    }
  }
  long long int m = 0;
  for (int i = 0; i < n; i++) {
    while (covered[m]) m++;
    if (b[i] == -1) {
      b[i] = m;
      covered[m] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << b[i] << " ";
  }
  cout << "\n";
  return 0;
}
