#include <bits/stdc++.h>
using namespace std;
const long long LINF = LLONG_MAX, MOD = 1e9 + 7, N = 1e5 + 5, LG = 20;
const int INF = INT_MAX;
const double PI = acos(-1), EPS = 1 / double(1e6);
void test() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
  }
  map<long long, vector<long long>> cnt;
  for (long long i = 0; i < n; ++i) {
    long long x = v[i];
    for (int j = 0; j < 31; ++j) {
      if (x & (1 << j)) cnt[j].push_back(i);
    }
  }
  long long idx = 0;
  for (int i = 30; i >= 0; --i) {
    if (cnt[i].size() == 1) {
      idx = cnt[i][0];
      break;
    }
  }
  cout << v[idx] << " ";
  for (int i = 0; i < n; ++i) {
    if (i == idx) continue;
    cout << v[i] << " ";
  }
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(15);
  int t = 1;
  for (int i = 1; i <= t; ++i) {
    test();
  }
  return 0;
}
