#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
using pii = pair<long long, long long>;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long first = 0;
  for (long long i = 30; i >= 0; i--) {
    long long pos = 0;
    long long ind = -1;
    for (long long j = 0; j < n; j++) {
      if ((a[j] >> i) & 1) {
        if (pos) {
          pos = 0;
          ind = -1;
          break;
        } else {
          pos = 1;
          ind = j;
        }
      }
    }
    if (pos) {
      first = ind;
      break;
    }
  }
  cout << a[first];
  for (long long i = 0; i < n; i++) {
    if (i == first) continue;
    cout << " " << a[i];
  }
  cout << "\n";
  return 0;
}
