#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define int long long
#define F first
#define S second
#define all(x, n, c) sort( x + c, x + n + c )
#define allv(x) sort( x.begin(), x.end() )
#define rev(x, n, c) reverse( x + c, x + n + c )
#define revv(x) reverse( x.begin(), x.end() )
#define sz(x) (x).size()
#define nl "\n"
#define IAmTheOneWhoKnocks ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

set< int >st;
const int N = 2e5;
int t[3 * N];
vector< int >v1;
map< int, int >mp, mp1;

void build( int v, int tl, int tr )
{
    if( tl == tr )
    {
        t[v] = v1[tl];
        mp[t[v]]++;
        return;
    }
    int m = (tl + tr) >> 1;
    build( v + v, tl, m );
    build( v + v + 1, m + 1, tr );
    t[v] = min( t[v + v], t[v + v + 1] );
    mp[t[v]]++;
}

void solve()
{
    v1.pb( N );
    int n;
    cin >>n;
    int a[n + 1];
        for( int i = 1; i <= n; i++ )
        {
            cin >>a[i];
            st.insert( a[i] );
            mp1[a[i] ]++;
        }
    if( n != sz( st ) + (sz(st) - 1) )
    {
        cout <<-1;
        return;
    }
    for( auto it:st )
    {
        v1.pb( it );
    }
    build( 1, 1, sz( st ) );
    for( auto it:st )
    {
        if( mp[it] != mp1[it] )
        {
            cout <<-1;
            return;
        }
    }
    for( auto it: st )
    {
        cout <<it <<" ";
    }
}

signed main()
{
    IAmTheOneWhoKnocks
    int T = 1;
    //cin >>T;
    while( T-- )
    { solve(); }
    return 0;
}
