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

int main()
{
	bool isOkay = true;
	long long n;
	cin >> n;
	long long el;
	long long x = 0;
	vector<long long> elements(n);
	while (x < n) {
		cin >> el;
		elements[x] = el;
		x++;
	}

	sort(elements.begin(), elements.end());

	long long min = elements[0];

	int count = 0;
	set<long long> setik;

	for (int i = 0; i < n; i++) {
		if (elements[i] == min) {
			count++;
		}
	}
	if (pow(2, count) - 1 == n) {
		for (int i = 0; i < n; i++) {
			setik.insert(elements[i]);
		}
		if (setik.size() == (n + 1) / 2) {
			isOkay = true;
		}
		else {
			isOkay = false;
		}
		long long counter = 0;
		long long maxcounter = 0;
		for (int i = n - 1; i > 0; i--) {
			if (elements[i] == elements[i - 1]) {
				counter++;
			}
			else {
				if (counter == maxcounter + 1 && counter > maxcounter) {
					maxcounter = counter;
					counter = 0;
				}
				else if (counter > maxcounter && counter != maxcounter + 1) {
					isOkay = false;
					break;
				}
				else {
					counter = 0;
					continue;
				}
			}
		}
	}
	else {
		isOkay = false;
	}
	if (isOkay == true) {
		multiset <long long> ::iterator counter = setik.begin();

		for (int i = 0; counter != setik.end(); i++, counter++) {
			cout << *counter << " ";
		}
	}
	else {
		cout << "-1";
	}
}