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>
//#include <boost/algorithm/string.hpp>
//#include <string>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pair<int,int> >
#define vi vector<int>
#define pb(x) push_back(x)
#define pbm(x,y) push_back({x,y})
#define ff first
#define ss second
#define vll vector<pair<ll,ll> >
#define vl vector<ll>
const double pi = 3.14159265358979323846;
#define int ll
ll mod = 1000000007;
//#define int ll
/*
vector < int> g[200001];
bool vis[200001]={0};


ll kmp(string x)
{
    ll n= x.length();
    //cout<<x<<endl;
    vector<ll> lcp(x.length(), 0);
    for(ll i=1;i<n;i++)
    {
        ll j=lcp[i-1];
        while(j>0 && x[j]!=x[i])
            j=lcp[j-1];
        if(x[i]==x[j])
            j++;
        lcp[i]=j;
    }
    return lcp[n-1];
}
ll dp[10000000]={0};
int power(ll x,ll y)
{
    ll res = 1;

    while (y > 0) {

        if (y & 1)
            res = (res * x)%mod;


        y = y >> 1;
        x = (x * x)%mod;
    }
    return res%mod;
}
bool fun(ll a)
{
    for (ll i=2;i<=sqrt(a);i++)
    {
        if (a%i==0)
            return false;
    }
    return true;
}
int lps(string s)
{
   int n = s.size();
   int i, j, cl;
   int l[n][n];
   for (i = 0; i < n; i++)
      l[i][i] = 1;
    for (cl=2; cl<=n; cl++)
    {
        for (i=0; i<n-cl+1; i++)
        {
            j = i+cl-1;
            if (s[i] == s[j] && cl == 2)
               l[i][j] = 2;
            else if (s[i] == s[j])
               l[i][j] = l[i+1][j-1] + 2;
            else
               l[i][j] = max(l[i][j-1], l[i+1][j]);
        }
    }

    return l[0][n-1];
}
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first );
}

int l=0;
int a[100001];ll n,m,ans=0;
bool vis[1000];
vector <int> adj[10000];
void bfs(int s)
{
   // l=0;
    queue <int> q;
    q.push(s);
    //int level[N]={0};
    //level[ s ] = 1 ;
    if(a[s]==1)l++;  //Setting the level of the source node as 0
    vis[ s ] = true;
    int level[100001]={0};
    if(a[1])level[s]=1;
    while(!q.empty())
    {
        int p = q.front();
        q.pop();
        int ss=0;
        int aa=v[p].size();
        for(int i = 0;i < v[ p ].size() ; i++)
        {
            if(vis[ v[ p ][ i ] ] == true)ss++;
        }
        if(level[p]<=m && ss==aa){ans++;}
        else
        {for(int i = 0;i < v[ p ].size() ; i++)
        {
            if(vis[ v[ p ][ i ] ] == false && a[p]*level[p]+a[v[p][i]]<=m)
            {
                l=l+a[i];
                level[ v[ p ][ i ] ] = a[p]*level[ p ]+a[v[p][i]];
                q.push(v[ p ][ i ]);
                vis[ v[ p ][ i ] ] = true;
            }
        }
        }
    }
    for(int i=0;i<2001;i++)
        l=max(l,level[i]);
}
void dfs(int s)
{
    vis[s] = true;
    for(int i = 0;i < adj[s].size();++i)
    {
        if(vis[adj[s][i]] == false)
            dfs(adj[s][i]);
    }
}
bool vis[100001]={0};
vector<int>v[100001];


int knapSack(int W,int n)
{
if (n == 0 || W == 0)
    return 0;
if (p[n-1] > W)
    return knapSack(W, n-1);
else return max( v[n-1] + knapSack(W-p[n-1], n-1),  knapSack(W, n-1) );
}*/

/*template <typename T, int MaxLen, typename Container=std::deque<T>>
class FixedQueue : public std::queue<T, Container>
{
    public:
    void push(const T& value)
    {
        if (this->size() == MaxLen)
        {
           this->c.pop_front();
        }
        std::queue<T, Container>::push(value);
    }
};
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll findlcm(int arr[], int n)
{
    ll ans = arr[0];
    for (int i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));
    return ans;
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll power(ll x,ll y)
{
    ll res = 1;

    while (y > 0) {

        if (y & 1)
            res = (res * x)%mod;


        y = y >> 1;
        x = (x * x)%mod;
    }
    return res%mod;
}
ll cubic_root(ll x){
    ll l = 1 , r=1000001;
    while(l<=r){
        ll m = (l+r)/2;
        if((m*m*m) == x)
            return m;
        else if(m*m*m > x)
            r = m-1;
        else
            l = m + 1;
    }
    return -1;
}
ll combi[1001][1001];
ll expo[1001];
bool flag;

void f() {
    if(flag) return;
    flag = 1;
    for(int n = 0; n < 1001; n += 1) {
        for(int k = 0; k <= n; k += 1) {
            if (k == 0 or k == n) {
                combi[n][k] = 1;
            }
            else {
                combi[n][k] = (combi[n-1][k] + combi[n-1][k-1]) % mod;
            }
        }
    }
    expo[0] = 1;
    for (int i = 1; i < 1001; i += 1) {
        expo[i] = (2 * expo[i-1]) % mod;
    }
}
ll step(ll cur,ll x)
{
    if(cur-x > 0)
        return cur - x;
    else
        return cur + x;
}

int power(ll x,ll y)
{
    ll res = 1;

    while (y > 0) {

        if (y & 1)
            res = (res * x)%mod;


        y = y >> 1;
        x = (x * x)%mod;
    }
    return res%mod;
}
int fun(ll n)
{
    if (n % 2 == 0)
        return n/2;

    for (int i = 3; i * i <= n; i += 2) {
        if (n % i == 0)
            return n/i;
    }

    return 1;
}
bool comp(const pll &a,
               const pll &b)
{
    if(a.first==b.first)return a.second<b.second;
       return (a.first < b.first );
}
int gcd(int x, int y) { return __gcd(x, y); }
long long lcm(int x, int y) { return x * 1ll * y / gcd(x, y); }



int mul(int x, int y)
{
    return (x * 1ll * y) % mod;
}
ll power(ll x,ll y)
{
    ll res = 1;

    while (y > 0) {

        if (y & 1)
            res = (res * x)% mod;


        y = y >> 1;
        x = (x * x)% mod;
    }
    return res%mod;
}
int inv(int x)
{
    return power(x,mod- 2);
}

int divide(int x, int y)
{
    return mul(x, inv(y));
}

int fact[200001];

void precalc()
{
    fact[0] = 1;
    for(int i = 1; i < 200001; i++)
        fact[i] = mul(fact[i - 1], i);
}

int C(int n, int k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
int n,m,cn=0;
const int dx[]={1,1,-1,-1};
const int dy[]={1,0,0,1};
//int vis[51];;
int c=0;
vector <int> adj[51];
void dfs(int s)
{
    vis[s]=1;c++;
    for(int i=0;i<adj[s].size();i++)
    {
        if(vis[adj[s][i]]==0)
            dfs(adj[s][i]);
    }
}*/
int vis[1000001]={0};
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<fixed;
    cout.precision(12);
    int q=1;
    //cin>>q;
    while(q--)
    {
        ll n,k;
        cin>>n;
        int a[n+1]={0},b[n+1]={0};
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
        }
        for (int i=1;i<=n;i++)
        {
            if(a[i]>i)
            {
                cout<<-1;return 0;
            }
            if (a[i]!=a[i-1])
            {
                b[i]=a[i-1];
                vis[b[i]]=1;
            }
        }
        vis[a[n]]=1;
        int j=0;
        for (int i=1;i<=n;i++)
        {
            while (vis[j])
                j++;
            if (b[i]==-1)
            {
                b[i]=j;
                vis[j]=1;
            }
            cout<<b[i]<<" ";
        }
    }
    return 0;
}



