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>
  #define ll            int
  #define pb            push_back
  #define eb            emplace_back
  #define ppb           pop_back
  #define si            set <ll>
  #define endl          '\n'
  #define F             first
  #define S             second
  #define mii           map<ll ,ll >
  #define msi           map<string,ll >
  #define mis           map<ll , string>
  #define rep(i,a,b)    for(ll  i=a;i<b;i++)
  #define all(v)        v.begin(),v.end()
  #define vsort(v)         sort(all(v))
  #define pii           pair<ll ,ll >
  #define vi            vector<ll >
  #define vii           vector<pair<ll , ll > >
  #define vs            vector<string>
  #define sz(x)         (ll )x.size()
  #define sl(x)          (ll )x.length()
  #define hell          1000000007
  #define bs            binary_search
  #define mp            make_pair
  #define sp(n)         setprecision(n)<<fixed
  #define spl           " "
  #define arr(a,n)        rep(i,0,n)cin>>a[i]
  #define mod            998244353
  #define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  #define M       10000001
  /*
  #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
  template <typename Arg1>
  void __f(const char* name, Arg1&& arg1){
      std::cerr << name << " : " << arg1 << endl;
  }
  template <typename Arg1, typename... Args>
  void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
  }
  */
   
  //#define abc   cin
  //#define qwe   cout
  using namespace std;
   
   
  ll fact(ll n) {
     if (n == 0 || n == 1)
        return 1;
     else
        return n * fact(n - 1);
  }
  ll power(ll base,ll exp) {
      ll res=1;
      while(exp>0) {
         if(exp%2==1) res=((res%hell)*(base%hell));
         base=((base%hell)*(base%hell));
         exp/=2;
      }
      return res%hell;
  }

  ll n,k; 


  int solve()
  {
cin>>n;
ll a[n];
rep(i,0,n)
cin>>a[i];
ll b[n]={0};
rep(i,0,n)
{
  if(a[i]>i+1)
  {
    cout<<"-1\n";
    return 0;
  }
}
rep(i,0,n)
b[i]=-1;
if(a[0]==1)
b[0]=0;
else
b[0]=1;
rep(i,1,n)
{
  if(a[i]!=a[i-1])
  {
    b[i]=a[i-1];
  }
}
ll f=0;
for(ll i=n-1;i>=0;i--)
{
  if(f==0)
  {
    if(b[i]==-1)
    {
      b[i]=a[n-1]-1;
      f=1;
      continue;
    }
  }
  if(b[i]==-1)
    b[i]=max(b[i+1]-1,a[i]+1);
}
rep(i,0,n)
cout<<b[i]<<spl;

  return 0;
  }

   
  signed main()
  {

         ios
      int test=1;
   
   
  //     cin>>test;
      while(test--){
          solve();
      }
      return 0;
  } 
