#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long arr[n + 1], ans[n + 1], present[100002];
  memset(present, 0, sizeof(present));
  for (long long x = 1; x <= n; x++) {
    cin >> arr[x];
    present[arr[x]] = 1;
  }
  for (long long x = 1; x <= n; x++) {
    if (x == 1) {
      if (arr[x] == 1) {
        ans[x] = 0;
        present[0] = 1;
      } else {
        for (long long y = 1; y <= 100000; y++) {
          if (present[y] == 0) {
            ans[x] = y;
            present[y] = 1;
            break;
          }
        }
      }
    } else {
      if (arr[x] != arr[x - 1]) {
        ans[x] = arr[x - 1];
        present[ans[x]] = 1;
      } else {
        for (long long y = ans[x - 1]; y <= 100000; y++) {
          if (present[y] == 0) {
            ans[x] = y;
            present[y] = 1;
            break;
          }
        }
      }
    }
  }
  for (long long x = 1; x <= n; x++) {
    cout << ans[x] << " ";
  }
  cout << "\n";
}
