#include <iostream>
#include <vector>
#include <string> 
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <iterator>
using namespace std;

#define ll long long


#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back
ll sum;
ll gcd(ll a, ll b) {
    if (a < b)
        return gcd(b, a);

    if (b == 0)
        return a;

    return gcd(b, a % b);



}
ll lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}
ll binpow(ll x, ll y) {
    ll g = 1;
    while (y) {
        if (y % 2) {
            g *= x;
        }
        x *= x;
        y /= 2;
    }
    return g;
}
bool koren(int n)
{
    int odd = 1;
    while (n > 0)
    {
        n = n - odd;
        odd = odd + 2;
    }
    return n == 0;
}
int pere(int n){
	sum = 0;
	while(n > 0){
		sum = sum * 10 + n % 10;
		n /= 10;
	}
	return sum;
}
int cnt = 0;
bool was[1000009];
int a[200005];
int main()
{
    cin.tie(NULL);
    cout.tie(NULL);
    ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	set<int>s;
	int nn = (n + 1) / 2;
	pair<int , int>p[nn+1];
	map<int , int>m;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		s.insert(a[i]);
		m[a[i]]++;
	}
	if(s.size() == n){
	int cur = 1;
	for(auto c : m){
		p[cur].F = c.second;
		p[cur].S = c.first;
		cur++;
	}
	sort(p,p + nn + 1);
	reverse(p , p + nn + 1);
	vector<int>arr;
	vector<int>arr2;
	int ans = 0;
	for(auto c : p){
		//cout << c.first << ' ' << c.second << endl;
		if(ans< nn / 2){
		    arr.pb(c.second);
		    ans++;
		}
		else{
		    if(c.first!=0)
		    arr2.pb(c.second);
		}
		
	}
	int pos = 1;
	sort(arr.bg , arr.en);
	sort(arr2.bg , arr2.en);
	//cout << endl;
	int cut = 0;
	int cut2 = 0;
	while(nn--){
	    if(pos%2 == 0){
	        cout << arr2[cut] << ' ';
	        cut++;
	    }
	    else{
	        cout << arr[cut2] << ' ';
	        cut2++;
	    }
	    pos++;
	   
	}
	}
	else
	cout << -1;
}


