#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn], b[maxn];
bool v[maxn];
int main() {
  int n;
  cin >> n;
  a[0] = -1;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    v[a[i]] = 1;
    if (a[i] > a[i - 1])
      b[i] = a[i - 1];
    else
      b[i] = -1;
  }
  int c = 0;
  for (int i = 1; i <= n; ++i) {
    if (b[i] == -1) {
      while (v[c]) c++;
      b[i] = c++;
    }
  }
  for (int i = 1; i <= n; ++i) cout << b[i] << ' ';
  return 0;
}
