#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 1e5 + 5;
int N;
int a[MAXN], cnt[30], p[30];
int main() {
  N = read();
  for (int i = 1; i <= N; i++) a[i] = read();
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < 30; j++)
      if (a[i] & (1 << j)) {
        cnt[j]++;
        p[j] = i;
      }
  }
  int pos = -1;
  for (int j = 0; j < 30; j++)
    if (cnt[j] == 1) {
      pos = p[j];
    }
  if (pos != -1) printf("%d ", a[pos]);
  for (int i = 1; i <= N; i++)
    if (i != pos) printf("%d ", a[i]);
  puts("");
  return 0;
}
