#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1, 0), ans(n + 1, -1), visited(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] > a[i - 1]) {
      ans[i] = a[i - 1];
      visited[a[i]] = 1;
    }
  }
  int j = 1;
  for (int i = 1; i <= n; i++) {
    if (ans[i] == -1) {
      while (j <= n && visited[j]) j++;
      ans[i] = j;
      visited[j] = 1;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
