#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  long long pos = -1;
  for (long long i = 59; i >= 0; i--) {
    bool flag = true;
    long long cans;
    for (long long j = 0; j < n; j++) {
      long long bit = (v[j] >> i) & 1;
      if (bit == 1) {
        if (flag) {
          flag = false;
          cans = j;
        } else {
          flag = true;
          break;
        }
      }
    }
    if (!flag) {
      pos = cans;
      break;
    }
  }
  if (pos != -1) {
    cout << v[pos] << " ";
  }
  for (long long i = 0; i < n; i++) {
    if (i != pos) cout << v[i] << " ";
  }
  cout << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
