#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int arr[n + 1];
    long long int ans[n + 1];
    unordered_map<long long int, long long int> mp;
    arr[0] = 0;
    for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
         i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {
      cin >> arr[i];
      mp[arr[i]] = 1;
    }
    long long int p = 0;
    for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
         i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {
      if (arr[i] != arr[i - 1]) {
        ans[i] = arr[i - 1];
        mp[arr[i - 1]] = 1;
        continue;
      }
      while (mp[p]) {
        p++;
      }
      ans[i] = p;
      mp[p] = 1;
    }
    for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
         i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1)))
      cout << ans[i] << " ";
    cout << endl;
  }
  return 0;
}
