#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:33554432")
using namespace std;
void dout() { cerr << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << H << ' ';
  dout(T...);
}
using ll = long long;
using ld = long double;
const int MAXN = 1e6 + 9;
void precalc() {}
map<int, int> cnt;
set<int> btt[30];
void solve() {
  int n;
  cin >> n;
  int maxx = -1;
  vector<int> orig;
  for (int i = 0; i < n; ++i) {
    int curr;
    cin >> curr;
    orig.push_back(curr);
    int x = curr;
    int pow = 0;
    while (x > 0) {
      if (x % 2) btt[pow].insert(curr);
      pow++;
      x /= 2;
    }
  }
  for (int i = 0; i < 30; ++i) {
    if (btt[i].size() == 1) maxx = *btt[i].begin();
  }
  if (maxx != -1) cout << maxx << " ";
  bool ok = true;
  for (auto e : orig) {
    if (e == maxx && ok) {
      ok = false;
      continue;
    }
    cout << e << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(20);
  precalc();
  solve();
}
