#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double PI = 3.14159265358;
const double EPS = 1e-8;
void solve() {
  int n;
  bitset<32> tmp;
  cin >> n;
  vector<int> v(n);
  vector<bitset<32>> bs(n);
  for (int i = 0; i < (n); i++) {
    cin >> v[i];
    bs[i] = v[i];
  }
  int idx, ct;
  for (int i = 31; i >= 0; i--) {
    ct = 0;
    for (int j = 0; j < (n); j++) {
      if (bs[j][i]) {
        ct++;
        idx = j;
      }
    }
    if (ct == 1) {
      cout << v[idx] << ' ';
      for (int j = 0; j < (n); j++) {
        if (j == idx)
          idx = -1;
        else
          cout << v[j] << ' ';
      }
      return;
    }
  }
  for (auto i : v) {
    cout << i << ' ';
  }
}
int main() {
  int T = 1;
  while (T--) {
    solve();
  }
}
