#include <bits/stdc++.h>
using namespace std;
const int NMax = 100001;
int n, rez, mx;
int st[NMax], a[NMax], fol[NMax], bit[NMax];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    for (int j = 0; j < 31; ++j) {
      if (a[i] & (1 << j)) {
        bit[j]++;
      }
    }
  }
  int ind = 1;
  for (int i = 1; i <= n; ++i) {
    rez = 0;
    for (int j = 0; j < 31; ++j) {
      if ((a[i] & (1 << j)) && bit[j] == 1) {
        rez += (1 << j);
      }
    }
    if (rez > mx) {
      ind = i;
      mx = rez;
    }
  }
  cout << a[ind] << ' ';
  for (int i = 1; i <= n; ++i) {
    if (i != ind) {
      cout << a[i] << ' ';
    }
  }
  return 0;
}
