#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  for (int bit = 31; bit >= 0; bit--) {
    int one = -1;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if ((v[i] >> bit) & 1) {
        cnt++;
        one = v[i];
      }
    }
    if (cnt == 1) {
      cout << one;
      for (int i = 0; i < n; i++) {
        if (v[i] != one) {
          cout << " " << v[i];
        }
      }
      cout << endl;
      return 0;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    cout << v[i] << " ";
  }
  cout << endl;
  return 0;
}
