#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 1e5 + 100;
int a[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 30; i >= 0; i--) {
    int ans = 0, sum = 0;
    for (int j = 1; j <= n; j++)
      if (a[j] & (1 << i)) ans = j, sum++;
    if (sum != 1) continue;
    cout << a[ans] << " ";
    for (int j = 1; j <= n; j++)
      if (j != ans) cout << a[j] << " ";
    return 0;
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  return 0;
}
