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