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;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 1e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
ll tree[Max+10];

ll aa=0;

ll query(ll idx)
{
    ll sum=0+aa;

    while(idx>0)
    {
        sum+=tree[idx];

        idx-= idx & (-idx);

    }

    return sum;
}

void update(ll idx,ll x,ll n)
{

    if(idx==0)
    {
        aa=1;
    }

    else{
    while(idx<=n)
    {
        tree[idx]+=x;

        idx+= idx & (-idx);
    }
    }
}
int main()
{

   fastread();

   ll i,j,n,m,p,sum=0,k,t,b,c,d,cnt=0,q;


     string str;

   bool flag=true;


    cin>>n;

     ll ara[n+2];

     input(ara,n);

     ll mx=ara[n-1];

       vector<ll>v;

       for(i=0; i<=n+5; i++)
       {
           if(mx!=i)
            v.eb(i);
       }

       for(i=0; i<n; i++)
       {
           if(v[i]==ara[i])
            swap(v[i],v[i+1]);


       }

        flag=true;

       for(i=0; i<n; i++)
       {
           update(v[i],1,n+5);

           if(query(ara[i])!=ara[i])
           {
               flag=false;

               break;
           }
       }

       if(flag){

       for(i=0; i<n; i++)
       cout<<v[i]<<" ";
    }

       else cout<<-1;

       cout<<endl;
}
