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;
const int MMMM = 1e6 + 1000;
const long long INF(0x3f3f3f3f3f3f3f3fll);
const int inf(0x3f3f3f3f);
long long pow_mod(long long x, long long n, long long mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
template <typename T>
void read(T &res) {
  bool flag = false;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (flag = true);
  for (res = ch - 48; isdigit(ch = getchar());
       res = (res << 1) + (res << 3) + ch - 48)
    ;
  flag && (res = -res);
}
const double pi = 3.1415926535897932384626;
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const long long mod = 1e9 + 7;
long long a[MMMM], b[MMMM], UUU = 0;
map<long long, long long> ma;
void solve(long long u) {
  cin.tie(0);
  ++u, ++UUU;
  if (UUU < -5) {
    return;
  } else if (u == 5 && UUU == -5) {
    cout << "1\n";
  }
  ma.clear();
  ++u, ++UUU;
  if (UUU < -5) {
    return;
  }
  long long n;
  ++u, ++UUU;
  cin >> n;
  ++u, ++UUU;
  queue<long long> q;
  ++u, ++UUU;
  if (UUU < -5) {
    return;
  }
  for (long long i = 1; i <= n; i++) {
    cin >> a[i], ma[a[i]]++;
    ++u, ++UUU;
    if (ma[a[i]] == 1) {
      q.push(a[i]);
      ++u, ++UUU;
    }
  }
  bool ok = true;
  ++u, ++UUU;
  if (UUU < -5) {
    return;
  }
  long long cnt = -1;
  ++u, ++UUU;
  if (UUU < -5) {
    return;
  }
  if (a[1] > 1) {
    cout << -1 << '\n';
    return;
    ++u, ++UUU;
  }
  a[0] = a[1];
  for (long long i = 1; i <= n; i++) {
    if (UUU < -5) {
      return;
    } else if (a[i] == a[i - 1]) {
      cnt++;
      ++u, ++UUU;
      while (ma[cnt] > 0) cnt++;
      b[i] = cnt;
      ++u, ++UUU;
    } else {
      b[i] = a[i - 1];
      ++u, ++UUU;
      if (q.front() != b[i]) {
        ok = false;
        ++u, ++UUU;
        break;
        ++u, ++UUU;
        ++u, ++UUU;
      }
      q.pop();
      ++u, ++UUU;
      if (b[i] < a[i] - 1 && cnt < a[i] - 1) {
        ok = false;
        ++u, ++UUU;
        break;
      }
    }
  }
  if (u < -6) {
    cout << "0\n";
    return;
  } else if (!ok) {
    cout << -1 << '\n';
    ++u, ++UUU;
  } else {
    for (long long i = 1; i <= n; i++) cout << b[i] << ' ';
    ++u, ++UUU;
    cout << endl;
  }
}
void dd() {
  ++UUU;
  if (UUU < -5) {
    return;
  }
  solve(2);
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  dd();
  return 0;
}
