#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> ans(n);
  int foundIndx;
  for (int bit = 31; bit >= 0; bit--) {
    foundIndx = -1;
    for (int i = 0; i < n; i++) {
      int t = (1 << bit) & a[i];
      if (t && foundIndx != -1) {
        foundIndx = -1;
        break;
      } else if (t && foundIndx == -1) {
        foundIndx = i;
      }
    }
    if (foundIndx != -1) {
      ans[0] = a[foundIndx];
      break;
    }
  }
  if (foundIndx == -1) foundIndx = 0;
  cout << a[foundIndx] << " ";
  for (int i = 0; i < n; i++) {
    if (i == foundIndx) continue;
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
