#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
long long binary_exp(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = (ans * a) % MOD;
    }
    a = (a * a) % MOD;
    b = b >> 1;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long T;
  T = 1;
  while (T--) {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> v(n + 1, 0);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      v[a[i]]++;
    }
    set<int> s;
    for (int i = 0; i <= n; i++) {
      if (v[i] == 0) {
        s.insert(i);
      }
    }
    auto it = s.begin();
    vector<int> b(n);
    b[0] = *it;
    it++;
    for (int i = 1; i < n; i++) {
      if (a[i] != a[i - 1]) {
        b[i] = a[i - 1];
      } else {
        b[i] = *it;
        it++;
      }
    }
    for (int i = 0; i < n; i++) {
      cout << b[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
