#include <bits/stdc++.h>
using namespace std;
long double pi = 3.14159265358979;
const int mod = 1e9 + 7;
const int N = 1e6 + 7;
void solve() {
  int n;
  cin >> n;
  int a[n + 1];
  int ok = 1;
  map<int, int> mp;
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
    if (a[i] > i) ok = 0;
    mp[a[i]] = 1;
  }
  if (!ok) {
    cout << -1;
    return;
  }
  int cur = 0;
  int ans[n + 1];
  for (int i = 1; i < n + 1; i++) {
    while (mp[cur]) cur++;
    if (i == 1) {
      ans[i] = cur++;
    } else {
      if (a[i] == a[i - 1]) {
        ans[i] = cur++;
      } else {
        ans[i] = a[i - 1];
      }
    }
    cout << ans[i] << " ";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  while (tc--) {
    solve();
    cout << '\n';
  }
  return 0;
}
