#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const long long int MOD = 1e9 + 7, INF = 1e18;
long long int dx[8] = {0, -1, 1, 0, 1, -1, 1, -1},
              dy[8] = {1, 0, 0, -1, -1, -1, 1, 1};
struct edge {
  long long int cost;
  long long int u, v;
};
long long int N, arr[200000];
int main() {
  cin >> N;
  for (long long int i = (0), i_end_ = (N); i < i_end_; i++) {
    cin >> arr[i];
  }
  long long int pos = 0;
  for (long long int i = (34) - 1, i_begin_ = (0); i >= i_begin_; i--) {
    long long int cnt = 0;
    for (long long int j = (0), j_end_ = (N); j < j_end_; j++) {
      if ((arr[j] >> i) % 2 == 1) {
        pos = j;
        cnt++;
      }
    }
    if (cnt == 1) {
      break;
    }
  }
  cout << arr[pos] << " ";
  for (long long int i = (0), i_end_ = (N); i < i_end_; i++) {
    if (i == pos) continue;
    cout << arr[i] << " ";
  }
  cout << '\n';
}
