#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define mii map<int,int>
#define ll long long
#define str string
#define S second
#define F first
#define lf else if
#define int long long

using namespace std;
ll n,mx=0;
ll a[200100];
ll t[4*200100];
map <int,int> mp;
map <int,int> np;
const int inf = 2e9;
void build(ll v, ll l, ll r) {
    if(l == r) {
        t[v] = a[l];
    } else {
        ll mid = (l+r)/2;
        build(2*v, l, mid);
        build(2*v+1, mid+1, r);
        t[v] = min(t[v+v],t[v+v+1]);
    }
    mp[t[v]]+=1;
}
/*ll get(ll v, ll tl, ll tr, ll l, ll r) {
    if(tr < l || tl > r) return 0;
    if(l <= tl && tr <= r) return t[v];
    ll mid = (tl+tr)/2;
    ll res1 = get(2*v, tl, mid, l, r);
    ll res2 = get(2*v+1, mid+1, tr, l, r);
    return res1+res2;
}*/
ll m;
//build(1, 1, n);
//get(1, 1, n, l, r);
//upd(1, 1, n, p, x);
signed main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    //srand( time(0));
	//rand()
	//freopen("sum.in", "r", stdin);
	//freopen("sum.out", "w", stdout);
	cin>>n;
    set <int> st;
    int v[n];
    for (int i=1;i<=n;i++) {
        cin>>v[i];
        np[v[i]]+=1;
        st.insert(v[i]);
    }
    int f=st.size();
    if((f+f-1)!=n)
    {
        cout<<-1;
        return 0;
    }
    int i=1;
    for(auto to: st){
        a[i]=to;
        i++;
    }
    build(1,1,st.size());
    for(int i=1;i<=n;i++)
    {
        if(mp[v[i]]!=np[v[i]])
        {
            cout<<-1;
            return 0;
        }
    }
    for(auto to: st){
        cout<<to<<" ";
    }
    return 0;
}