#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
int high_digit[100];
int high_digit_label[100];
int Process(int i) {
  int x = a[i];
  int cnt = 0;
  int high = -1;
  while (x) {
    if (x & 1) {
      ++high_digit[cnt];
      high_digit_label[cnt] = i;
    }
    ++cnt;
    x = x >> 1;
  }
  return high;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] == 0)
      continue;
    else {
      Process(i);
    }
  }
  int label = -1;
  for (int i = 99; i >= 0; --i) {
    if (high_digit[i] == 1) {
      label = high_digit_label[i];
      break;
    }
  }
  if (label != -1) cout << a[label] << " ";
  for (int i = 0; i < n; ++i) {
    if (i != label) cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
