#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 10;
const long long int mod = 1e9 + 7;
const double pi = acos(-1);
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n;
  cin >> n;
  vector<long long int> a(n), have(N, 0);
  for (long long int i = 0; i < n; ++i) {
    cin >> a[i];
    have[a[i]]++;
  }
  long long int mex = 0;
  vector<long long int> ans(N, -1);
  for (long long int i = 0; i < n; ++i) {
    if (ans[i] == -1) {
      while (have[mex] > 0) ++mex;
      ans[i] = mex;
      ++mex;
    }
    --have[a[i]];
    if (have[a[i]] == 0) {
      ans[i + 1] = a[i];
      mex = max(mex, a[i] + 1);
    }
  }
  for (long long int i = 0; i < n; ++i) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
