#include <bits/stdc++.h>
using namespace std;
int arr[100005];
vector<int> adj[100005];
bool vis[100005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    int mx = 0;
    bool ok = true;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      arr[i] = x;
      vis[x] = 1;
    }
    queue<int> q;
    int out = 0;
    for (int i = 0; i <= n; i++) {
      if (!vis[i]) q.push(i);
    }
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        if (vis[arr[i]]) {
          cout << q.front() << " ";
          q.pop();
        } else
          cout << i << " ";
      } else if (arr[i] == arr[i - 1]) {
        cout << q.front() << " ";
        q.pop();
      } else {
        cout << arr[i - 1] << " ";
      }
    }
  }
  return 0;
}
