#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, i;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  int ind = -1;
  for (int j = 30; j >= 0; j--) {
    int count = 0, m = (1 << j);
    for (i = 0; i < n; i++) {
      if (a[i] & m) {
        count++;
        ind = i;
      }
    }
    if (count == 1) break;
    ind = -1;
  }
  if (ind != -1) cout << a[ind] << " ";
  for (i = 0; i < n; i++) {
    if (i != ind) cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
