#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::string;
int n, a[100010], cnt, ans;
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ans = -1;
  cin >> n;
  for (register int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (register int i = 30; i >= 0; --i) {
    cnt = 0;
    for (register int j = 1; j <= n; ++j) {
      if (a[j] & (1 << i)) {
        ++cnt;
        ans = j;
        if (cnt > 1) break;
      }
    }
    if (cnt == 1) {
      break;
    }
  }
  if (ans != -1) cout << a[ans] << " ";
  for (register int i = 1; i <= n; ++i) {
    if (i == ans) continue;
    cout << a[i] << " ";
  }
  return 0;
}
