n = int(input())
l = list(map(int, input().split()))
freq = [0] * 32
for i in l:
    for j in range(32):
        if (i >> j) & 1: freq[j] -= -1
ans = -1
ind = -1
for i in range(n):
    temp = 0
    for j in range(32):
        if freq[j] == 1 and (l[i] >> j) & 1:
            temp += (2 ** j)
    if temp > ans:
        ans = temp
        ind = i
print(l[ind], end = " ")
for i in range(n):
    if i != ind: print(l[i], end = " ")