#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  multiset<int> s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long id = -1;
  for (long x = 32; x >= 0; x--) {
    long dem = 0;
    for (long i = 0; i < n; i++) {
      if (1ll * ((1ll * a[i] >> x) & 1) == 1) {
        dem++;
      }
    }
    if (dem == 1) {
      id = x;
      break;
    }
  }
  for (long i = 0; i < n; i++) {
    if ((a[i] >> id) & 1) swap(a[i], a[0]);
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
