#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	set<int> b;
	multiset<int> c;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		b.insert(a[i]);
		c.insert(a[i]);
	}
	if (2 * b.size() - 1 != a.size()) {
		cout << -1;
		return 0;
	}
	vector<int> d;
	for (auto e : b) {
		c.erase(e);
		d.push_back(e);
	}
	int i = d.size() - c.size();
	for (auto e : c) {
		if (e > d[i]) {
			cout << -1;
			return 0;
		}
		i++;
	}
	for (auto e : b) {
		cout << e << ' ';
	}	
	return 0;
}