#include <bits/stdc++.h>
using namespace std;
const int PI = 3.1415926535;
const int inf = 1000111222;
const int mod = 1000000007;
const int N = 100007;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> ar(n);
  for (int i = 0; i < n; i++) cin >> ar[i];
  vector<int> entries;
  int ans = 0;
  for (int i = 30; i >= 0; i--) {
    entries.clear();
    for (int j = 0; j < n; j++) {
      if ((1 << i) & ar[j]) {
        entries.push_back(j);
      }
    }
    if (entries.size() == 1) {
      ans = entries[0];
      break;
    }
  }
  vector<int> order;
  order.push_back(ans);
  for (int i = 0; i < n; i++) {
    if (i != ans) order.push_back(i);
  }
  for (int i = 0; i < n; i++) {
    cout << ar[order[i]] << " ";
  }
  cout << "\n";
  return 0;
}
