#include <bits/stdc++.h>
using namespace std;
int ar[100004];
int main() {
  int t, n, i, j, x, y, flag = 0, fi = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (i = 30; i >= 0; i--) {
    flag = 0;
    for (j = 1; j <= n; j++) {
      if ((ar[j] >> i) & 1) {
        flag++;
        fi = j;
      }
    }
    if (flag == 1) {
      cout << ar[fi] << ' ';
      for (i = 1; i <= n; i++) {
        if (i == fi)
          continue;
        else
          cout << ar[i] << ' ';
      }
      cout << endl;
      return 0;
    }
  }
  for (i = 1; i <= n; i++) cout << ar[i] << ' ';
  cout << endl;
  flag = 0;
  return 0;
}
