#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans[n];
  memset(ans, -1, sizeof(ans));
  int p = 0, cur = a[0], no = 0;
  if (a[0] == 1)
    ans[0] = 0;
  else if (a[0] != 0)
    no = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] != cur) {
      ans[i] = cur;
      for (int j = cur + 1; j < a[i]; j++) {
        while (ans[p] != -1) p++;
        if (p > i) {
          no = 1;
          break;
        }
        ans[p] = j;
      }
      cur = a[i];
    }
    if (no) {
      break;
    }
  }
  if (no) {
    cout << "-1\n";
    return 0;
  }
  int mx = n + 2;
  for (int i = 0; i < n; i++) {
    if (ans[i] == -1) ans[i] = mx++;
    cout << ans[i] << " ";
  }
  return 0;
}
