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>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int first = 0;
  cerr << '{';
  for (auto &i : x) cerr << (first++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const long long INF = 9e18;
long long mod = 1000000007;
inline long long fast_expo(long long base, long long power,
                           long long modulo = mod) {
  base %= modulo;
  if (base < 0) base += modulo;
  long long x = base, cnt = power, ans = 1;
  while (cnt) {
    if (cnt & 1) ans = (ans * x) % modulo;
    x = (x * x) % modulo;
    cnt >>= 1;
  }
  return ans;
}
long long takemod(long long a, long long mo) {
  a %= mo;
  if (a < 0) a += mo;
  return a;
}
long long modinv(long long a, long long mo) {
  return takemod(fast_expo(takemod(a, mo), mo - 2, mo), mo);
}
long long cal_nex(vector<long long> &free, long long in) {
  if (free[in] == in) {
    return in;
  }
  return free[in] = cal_nex(free, free[in]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> arr(n);
  map<long long, long long> chosen;
  for (int i = (0); i < long long(long long(n)); ++i) {
    cin >> arr[i];
  }
  bool can = true;
  for (int i = (1); i < long long(n); ++i) {
    if (arr[i] < arr[i - 1]) {
      can = false;
      break;
    }
  }
  if (!can) {
    cout << -1 << '\n';
    return 0;
  }
  for (int i = (0); i < long long(long long(n)); ++i) {
    if (arr[i] > i + 1) {
      can = false;
      break;
    }
  }
  if (!can) {
    cout << -1 << '\n';
    return 0;
  }
  vector<long long> start(n + 1);
  for (int i = (0); i < long long(long long(n)); ++i) {
    start[arr[i]] = i + 1;
  }
  vector<long long> ans(n + 1, -1);
  vector<long long> nexfree(n + 10);
  for (int i = (0); i < long long(long long(n + 10)); ++i) {
    nexfree[i] = i;
  };
  for (int i = (0); i < long long(long long(n + 1)); ++i) {
    long long in = start[i];
    if (nexfree[in] < n + 1) {
      ans[nexfree[in]] = i;
      nexfree[in]++;
      cal_nex(nexfree, in);
    }
  };
  long long pre = -1;
  for (int i = (0); i < long long(long long(n)); ++i) {
    if (ans[i] == -1) {
      cout << pre << " ";
    } else {
      cout << ans[i] << " ";
      pre = ans[i];
    }
  }
  cout << '\n';
  return 0;
}
