#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, a[N], cnt[60];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    int x = a[i], w = 0;
    while (x) {
      if (x & 1) cnt[w]++;
      x >>= 1;
      w++;
    }
  }
  int s = 1, maxs = 0;
  for (int i = 1; i <= n; i++) {
    int x = a[i], now = 0, w = 0, kk = 1;
    while (x) {
      if ((cnt[w] == 1) && (x & 1)) now += kk;
      x >>= 1;
      w++;
      kk <<= 1;
    }
    if (now > maxs) {
      maxs = now;
      s = i;
    }
  }
  printf("%d ", a[s]);
  for (int i = 1; i <= n; i++)
    if (s != i) printf("%d ", a[i]);
  return 0;
}
