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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long power_mod(long long x, long long y, long long m) {
  long long arr = 1;
  x %= m;
  while (y) {
    if (y & 1) {
      arr = (arr * x) % m;
    }
    y >>= 1;
    x = (x * x) % m;
  }
  return arr;
}
long long power(long long x, long long y) {
  long long arr = 1;
  while (y) {
    if (y & 1) {
      arr *= x;
    }
    y >>= 1;
    x = x * x;
  }
  return arr;
}
long long mod_inv(long long x, long long m) { return power_mod(x, m - 2, m); }
int randomGenerator(int limit) {
  random_device rd;
  mt19937 gen(rd());
  uniform_int_distribution<> dis(1, limit);
  return dis(gen);
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
bool comp(const pair<long long, pair<long long, long long>> &a,
          const pair<long long, pair<long long, long long>> &b) {
  if (a.first == b.first) {
    return (a.second < b.second);
  }
  return (a.first < b.first);
}
struct hash_pair {
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2> &p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ hash2;
  }
};
bool isPalindrome(string s) {
  bool flag = true;
  for (int i = 0; i < s.length() / 2; i++) {
    if (s[i] != s[s.length() - i - 1]) {
      flag = false;
      break;
    }
  }
  return flag;
}
bool isPerfectSquare(long long n) {
  long double val = sqrt(n);
  return (val - floor(val) == 0);
}
bool isPrime(long long n) {
  if (n < 2) {
    return false;
  }
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
long long NCR(long long n, long long k) {
  long long res = 1;
  if (k > n - k) {
    k = n - k;
  }
  for (int i = 0; i < (k); i++) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
long long cntBits(long long n) {
  long long cnt = 0;
  for (long long i = 0; i < 64; i++) {
    if ((1ll << i) & n) {
      cnt++;
    }
  }
  return cnt;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n), ans(n, -1), hash(1000001, 0);
  int flag = 0;
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
    if (a[i] > i + 1) {
      flag = 1;
    }
    if (i > 0 and (a[i] != a[i - 1])) {
      ans[i] = a[i - 1];
      hash[a[i - 1]] = 1;
    }
  }
  if (flag) {
    cout << -1 << "\n";
    return;
  }
  hash[a[n - 1]] = 1;
  long long cnt = 0;
  for (int i = 0; i < (n); i++) {
    if (ans[i] == -1) {
      while (hash[cnt] != 0) {
        cnt++;
      }
      ans[i] = cnt;
      hash[cnt] = 1;
      cnt++;
    }
  }
  for (int i = 0; i < (n); i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
