n = int(input())
a = list(map(int, input().split()))
bitsum = [0]*32
for i in a:
    for j in range(32):
        bitsum[j] += i>>j&1
onebit = None
for i in range(31, -1, -1):
    if bitsum[i]==1:
        onebit = i
        break
if onebit is None:
    print(*a)
    exit(0)
for i in range(n):
    if a[i]>>onebit&1:
        first = i
        break
a = [a[first]] + a[:first] + a[first+1:]
print(*a)