Given an array a of length n, find another array, b, of length n such that:

  * for each i (1 ≤ i ≤ n) MEX(\\{b_1, b_2, …, b_i\})=a_i. 



The MEX of a set of integers is the smallest non-negative integer that doesn't belong to this set.

If such array doesn't exist, determine this.

Input

The first line contains an integer n (1 ≤ n ≤ 10^5) — the length of the array a.

The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i ≤ i) — the elements of the array a. It's guaranteed that a_i ≤ a_{i+1} for 1≤ i < n.

Output

If there's no such array, print a single line containing -1.

Otherwise, print a single line containing n integers b_1, b_2, …, b_n (0 ≤ b_i ≤ 10^6)

If there are multiple answers, print any.

Examples

Input


3
1 2 3


Output


0 1 2 

Input


4
0 0 0 2


Output


1 3 4 0 

Input


3
1 1 3


Output


0 2 1 

Note

In the second test case, other answers like [1,1,1,0], for example, are valid.
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void out(T t) {
  cout << t << "\n";
}
template <class T, class... Ts>
inline void out(T t, Ts... ts) {
  cout << t << " ";
  out(ts...);
}
template <class T>
inline bool CHMIN(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool CHMAX(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
constexpr long long INF = 1e18;
void solve() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  vector<long long> cnt(1000100);
  for (long long i = 0; i < (long long)N; ++i) {
    cin >> a[i];
    ++cnt[a[i]];
  }
  vector<long long> cand;
  for (long long i = 0; i < (long long)1000100; ++i)
    if (!cnt[i]) cand.emplace_back(i);
  long long candIdx = 0;
  vector<long long> mex(1000100);
  vector<long long> ans(N);
  long long now = 0;
  for (long long i = 0; i < (long long)N; ++i) {
    if (a[i] > now) {
      mex[now] = 1;
      ans[i] = now;
      while (mex[now] == 1) ++now;
    } else {
      while (mex[cand[candIdx]] == 1) ++candIdx;
      mex[cand[candIdx]] = 1;
      ans[i] = cand[candIdx];
      ++candIdx;
    }
    if (now < a[i]) {
      out(-1);
      return;
    }
  }
  for (long long i = 0; i < (long long)ans.size(); ++i)
    cout << ans[i] << " \n"[i + 1 == ans.size()];
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long Q = 1;
  while (Q--) solve();
}
