#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define sz(s) (int)s.size()
#define in insert
#define pii pair<int, int>
#define pb push_back
#define all(x) x.begin(), x.end()
 
const int MAX=2e5+10;
 
int n;
int a[MAX];
int ans[MAX];
vector<int> v[30];
vector<int> qq;
int t[300100];

void build(int v, int l, int r){
    if(l == r){
        qq.pb(ans[l]);
        t[v] = ans[l];
        return;
    }
    int mid=(l+r)/2;
    build(v+v, l, mid);
    build(v+v+1, mid+1, r);
    t[v] = min(t[v + v], t[v + v + 1]);
    qq.pb(t[v]);
}
 
int main(){
    cin>>n;
    set<int> st;
    map<int,int> cnt,c;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        cnt[a[i]]++;
        st.in(a[i]);
    }
    int n1=(n+1);
    if(sz(st)!=n1/2){
        cout<<-1<<"\n";
        return 0;
    }
    for(int x:st){
        c[cnt[x]]++;
    }
    int x=1;
    int l=__lg(n1);
    n1/=2;
    // cout<<l<<"\n";
    for(int i=l;i>=1;i--){
        c[i]+=c[i+1];
    }
    for(int i=1;i<=l;i++){
        if(c[i]==n1){
            n1/=2;
        }
        else{
            cout<<-1<<"\n";
            return 0;
        }
    }
    // cout<<n1<<"\n";
    for(int x:st){
        v[cnt[x]].pb(x);
    }
    set<int> dd;
    for(int i=1; i<=(n + 1)/2; i++){
        dd.insert(i);
    }
    sort(v[1].begin(), v[1].end());
    for(int i=0;i<v[1].size();i++){
        ans[i * 2 + 1] = v[1][i];
        dd.erase(dd.find(v[1][i])); 
    }
    int ls = 2;
    for(auto it = dd.begin(); it != dd.end(); it++){
        ans[ls] = *it;
        ls+=2;
    }
    build(1, 1, (n + 1) / 2);
    sort(all(qq));
    sort(a + 1, a + 1 + n);
    for(int i=1; i<=n; i++){
        if(qq[i - 1] != a[i]){
            cout<<-1;
            return 0;
        }
    }
    for(int i=1;i<=(n+1)/2;i++)cout<<ans[i]<<" ";
}