#include <bits/stdc++.h>
using namespace std;
int v[100009], bit[69], ceea_ce_ramane[100009];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    for (int j = 0; j <= 30; ++j) {
      int nr = (1 << j);
      if (v[i] & nr) {
        bit[j]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 30; ++j) {
      int nr = (1 << j);
      if (v[i] & nr) {
        if (bit[j] == 1) {
          ceea_ce_ramane[i] += nr;
        }
      }
    }
  }
  int maxim = 0, pos = -1;
  for (int i = 1; i <= n; ++i) {
    if (maxim < ceea_ce_ramane[i]) {
      maxim = ceea_ce_ramane[i];
      pos = i;
    }
  }
  if (pos == -1) {
    pos = 1;
  }
  cout << v[pos] << " ";
  for (int i = 1; i <= n; ++i) {
    if (i != pos) {
      cout << v[i] << " ";
    }
  }
  return 0;
}
