#include "bits/stdc++.h"

using namespace std;

int main() {
    int m = 0, a, k = 0, c = 0, cc = 0;
    cin >> a;
    int n = a + 1;
    while(n > 1){
        n = n / 2;
        k++;
    }
    vector<long long> f(a);
    for(int i = 0; i < a; i++)
        cin >> f[i];
    sort(f.begin(), f.end());
    vector < long long > p = f;
    for(int i = 0; i < a; i++)
        if (f[i] == f[0])
            c++;
    if (k != c){
        cout << "-1";
        return 0;
    }
    else{
        p.erase(unique(p.begin(), p.end()), p.end());
        vector < long long > z(p.size(), 0);
        for(int i = 0; i < p.size(); i++)
            for(int j = 0; j < a; j++){
                if(p[i] == f[j])
                    z[i] += 1;
            }
        sort(z.begin(), z.end());
        for(int j = 0; j < z.size(); j++){
            if(z[j] == z[z.size() - 1])
                cc++;
        }
        if (cc > 1){
            cout << "-1";
            return 0;
        }
        f.erase(unique(f.begin(), f.end()), f.end());
        for(int i = 0; i < f.size(); i++)
            cout << f[i] << " ";
    }
    return 0;
}
