#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int divf[63];
void divvv(ll tmp, int step) {
  int cnt = 33;
  while (tmp) {
    ll t = pow(2, cnt);
    if (tmp >= t) {
      tmp -= t;
      divf[cnt] += step;
    }
    cnt--;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> v(n);
  for (auto &ele : v) {
    cin >> ele;
    divvv(ele, 1);
  }
  ll best = -1, mark = -1;
  for (int i = 0; i < n; ++i) {
    ll tmp = 0;
    for (int j = 33; j >= 0; --j)
      if (divf[j] == 1 && v[i] & (1ll << j)) tmp += pow(2, j);
    if (tmp > best) {
      best = tmp;
      mark = i;
    }
  }
  cout << v[mark] << " ";
  for (int i = 0; i < n; ++i) {
    if (mark == i)
      continue;
    else
      cout << v[i] << " ";
  }
  cout << endl;
  return 0;
}
