import sys
from math import log2


stdin = sys.stdin.readlines()
n = int(stdin[0])
a = sorted(map(int, stdin[1].split()))
a_dict = {
    key: a.count(key)
    for key in set(a)
}

elements = (n + 1) // 2
factor = log2(elements)

if a_dict[a[0]] == factor + 1:
    print(" ".join(map(str, a_dict.keys())))
else:
    print(-1)

