#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
long long a[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 31; i >= 0; i--) {
    cnt = 0;
    for (int j = 1; j <= n; j++) {
      if ((a[j] >> i) & 1) {
        cnt++;
        k = j;
      }
    }
    if (cnt == 1) {
      break;
    }
  }
  if (cnt == 1) {
    swap(a[1], a[k]);
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << ' ';
  }
  return 0;
}
