#include <bits/stdc++.h>
using namespace std;
const int N = 2000005;
int n;
int main() {
  scanf("%d", &n);
  vector<int> a(n + 1), cnt(32, 0);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    for (int j = 0; j < 31; ++j)
      if ((a[i] >> j) & 1) cnt[j]++;
  }
  int mx = -1, p = -1;
  for (int i = 1; i <= n; ++i) {
    int cur = 0;
    for (int j = 0; j < 31; ++j) {
      if ((a[i] >> j) & 1) {
        if (cnt[j] == 1) cur = cur | (1 << j);
      }
    }
    if (mx < cur) mx = cur, p = i;
  }
  printf("%d ", a[p]);
  for (int i = 1; i <= n; ++i) {
    if (i == p) continue;
    printf("%d ", a[i]);
  }
  return 0;
}
