#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1e5 + 50;
inline int read() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x;
}
int n, maxn;
int num[SIZE], vis[SIZE], ans[SIZE];
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) {
    num[i] = vis[i] = read();
    maxn = max(maxn, num[i]);
  }
  int indax = 0;
  while (maxn > 0) {
    maxn /= 2;
    int tmp = 0, p = 0;
    for (int i = 1; i <= n; ++i) {
      if (vis[i] % 2) {
        tmp++;
        if (tmp == 1) {
          p = i;
        }
      }
      vis[i] >>= 1;
    }
    if (tmp == 1) {
      ans[p] += (1 << indax);
    }
    indax++;
  }
  int tmp = -1e9, p = 0;
  for (int i = 1; i <= n; ++i) {
    if (tmp < ans[i]) {
      tmp = ans[i];
      p = i;
    }
  }
  printf("%d ", num[p]);
  for (int i = 1; i <= n; ++i) {
    if (i == p) continue;
    printf("%d ", num[i]);
  }
  return 0;
}
