#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int index = 0;
  int cnt = 0;
  for (int i = 30; i >= 0; i--) {
    cnt = 0;
    for (int j = 0; j < n; j++) {
      if ((a[j] >> i) & 1) cnt++, index = j;
    }
    if (cnt == 1) break;
  }
  int temp = a[index];
  a[index] = a[0];
  a[0] = temp;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
}
