#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& p) {
  os << "(" << p.first << "," << p.second << ") ";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (auto i : v) os << i << " ";
  return os;
}
const long long int mxN = 2e5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  set<long long int> s1;
  long long int a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i], s1.insert(a[i]);
  set<long long int> s2;
  for (long long int i = 0; i <= n; i++) {
    if (s1.find(i) == s1.end()) s2.insert(i);
  }
  for (long long int i = 0; i < n; i++) {
    if (i && a[i] != a[i - 1]) s2.insert(a[i - 1]);
    cout << (*s2.begin()) << " ";
    s2.erase(s2.begin());
  }
}
