n = int(input())
a = sorted(map(int,input().split()))
b = set(a)
if bin(len(b)).count("1") != 1:
    print(-1)
    exit()
if 2 * len(b) - 1 != len(a):
    print(-1)
    exit()
    
c = [list(b)]
while len(c[-1]) != 1:
    c.append([])
    for i in range(0, len(c[-2]) // 2 + 1, 2):
        c[-1].append(min(c[-2][i], c[-2][i + 1]))
d = []
for e1 in c:
    for e in e1:
        d.append(e)
d.sort()
if a != d:
    print(-1)
else:
    for e in b:
        print(e, end = " ")