#include <bits/stdc++.h>
using namespace std;
long long INF = 0x7FFFFFFFFFFFFFFF;
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  ;
  vector<long long> b(n, -1);
  for (long long i = 1; i < n; ++i) {
    if (a[i - 1] != a[i]) b[i] = a[i - 1];
  }
  long long cnt = 0;
  set<long long> st;
  for (long long i = 0; i < n; ++i) st.insert(a[i]);
  for (long long i = 0; i < n; ++i) {
    if (b[i] == -1) {
      while (st.find(cnt) != st.end()) cnt++;
      b[i] = cnt;
      cnt++;
    }
  }
  for (auto x : b) cout << x << ' ';
  cout << '\n';
  ;
}
