#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
using namespace std;

int main()
{
    int n;
    cin >> n;
    long long m[n];
    vector<long long> raz;
    vector<long long> sum;
    for (int i = 0; i < n; ++i) {
        cin >> m[i];
    }
    sort(m, m + n);
    int i = 0;
    while (i < n) {
        int sumr = 1;
        while (m[i] == m[i + 1]) {
            ++sumr;
            ++i;
        }
        raz.push_back(m[i]);
        sum.push_back(sumr);
        ++i;
    }
          if(n != pow(2, sum[0])-1) {
            cout << "-1";
        }
        else{
            for (int l = 0; l < raz.size(); ++l) {
                cout << raz[l] << " ";
            }
        }
}