/*#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
const int N=1000000001;
using namespace std;
int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<pair<int, int>> initialEdges;
    vector<pair<int, int>> finalEdges;
    set<pair<int, int>> initialEdgesSet;
    set<pair<int, int>> finalEdgesSet;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        initialEdges.push_back(make_pair(u, v));
        initialEdgesSet.insert(make_pair(u, v));
    }
    for (int i = 0; i < k; i++) {
        int u, v;
        cin >> u >> v;
        finalEdges.push_back(make_pair(u, v));
        finalEdgesSet.insert(make_pair(u, v));
    }
    return 0;
}*/
/*
int main(){
    int n,q,k;
    cin>>n>>g>>k;
    int qq[n+1];
    for(int i=0;i<n;i++){
        cin>>qq[i];
    }
    int newq[n+1];
    int l,r;
    while(q--){
        cin>>l>>r;
        for(int i=0;i<n;i++){
            newq[i]=q
        }
    }
}

*/
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<pair<int, int>>nu;
int main()
{
    int n;
    cin>>n;
    int a[n+5];
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1, a+1+n);
    int ch=a[1], ind = 1;
    for (int i=1;i<=n+1;i++)
    {
        if (a[i] != ch)
        {
            nu.push_back(make_pair(i - ind, ch));
            ch = a[i];
            ind = i;
        }
    }
    sort(nu.begin(), nu.end());
    int siz = nu.size();
    /*for (int i=0;i<siz;i++)
    {
        cout<<nu[i].first<<" ";
    }
    cout<<endl;
    for (int i=0;i<siz;i++)
    {
        cout<<nu[i].second<<" ";
    }
    cout<<endl;*/
    int ogh=0;
    for (int i=0;i<siz - 1;i+=2)
    {
        if (nu[i].first == nu[i+1].first)
        {
            ogh ++;
        }
    }
    if (ogh == nu.size() - 1)
    {
        cout<<-1;
        return 0;
    }
    vector <int> ans;
    for (int i=0;i<siz/2;i++)
    {
        ans.push_back(nu[i].second);
        ans.push_back(nu[siz-i-1].second);
    }
    for (int i=0;i<ans.size();i+=2)
    {
        if (ans[i] <= ans[i+1])
        {
            cout<<-1;
            return 0;
        }
    }
    for (int i=0;i<ans.size()-1;i++)
    {
        if (ans[i] == ans[i+1])
        {
            cout<<-1;
            return 0;
        }
    }
    for (int i=0;i<ans.size();i++)
    {
        cout<<ans[i]<<" ";
    }
}
