#include <bits/stdc++.h>
using namespace std;
struct type {
  long long k, i, j;
};
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long findSubarray(long long arr[], long long n, long long k) {
  long long window_sum = 0;
  long long min_window = INT_MAX;
  long long last = 0;
  for (long long i = 0; i < n; i++) {
    window_sum += arr[i];
    if (i + 1 >= k) {
      if (min_window > window_sum) {
        min_window = window_sum;
        last = i;
      }
      window_sum -= arr[i + 1 - k];
    }
  }
  long long sum = 0;
  for (long long i = last - k + 1; i <= last; i++) {
    sum += arr[i];
  }
  return sum;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> a(n), b;
  for (long long i = 0; i < n; i++) cin >> a[i];
  set<long long> s;
  for (long long i = 0; i < n; i++) s.insert(a[i]);
  vector<long long> c;
  for (long long i = 0; i <= n; i++) {
    if (s.find(i) == s.end()) {
      c.push_back(i);
    }
  }
  b.push_back(c[0]);
  long long x = 1;
  for (long long i = 1; i < n; i++) {
    if (a[i] == a[i - 1]) {
      b.push_back(c[x]);
      x++;
    } else {
      b.push_back(a[i - 1]);
    }
  }
  for (auto x : b) cout << x << " ";
  cout << "\n";
}
