#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> vec(n);
  for (long long &i : vec) cin >> i;
  for (long long i = 29; i > -1; i--) {
    long long c = 0, ind = 0;
    for (long long j = 0; j < n; j++) {
      if ((vec[j] >> i) & 1) {
        c++;
        ind = j;
      }
    }
    if (c == 1) {
      swap(vec[0], vec[ind]);
      break;
    }
  }
  for (long long i : vec) cout << i << " ";
  return 0;
}
