#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 30; i >= 0; i--) {
    long long c = 0;
    long long ele = -1;
    for (int j = 0; j < n; j++) {
      if (v[j] & (1ll << i)) {
        c++;
        ele = v[j];
      }
    }
    if (c == 1) {
      cout << ele << " ";
      for (auto I : v) {
        if (I == ele)
          continue;
        else
          cout << I << " ";
      }
      return 0;
    }
  }
  for (auto i : v) cout << i << " ";
}
