#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int sum(int a, int b) {
  int c = a + b;
  if (c >= mod) {
    c -= mod;
  }
  return c;
}
int dif(int a, int b) {
  int c = a - b;
  if (c < 0) {
    c += mod;
  }
  return c;
}
int mlt(int a, int b) {
  long long c = a * 1LL * b;
  return c % mod;
}
int ibit(int n, int i) { return ((n >> i) & 1); }
void solve(istream &cin = std::cin, ostream &cout = std::cout) {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<vector<int>> ibits(31);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j <= 30; j++) {
      if (ibit(a[i], j)) {
        ibits[j].push_back(i);
      }
    }
  }
  int cur = 0;
  for (int i = 30; i >= 0; i--) {
    if (ibits[i].size() == 1) {
      cur = ibits[i][0];
      break;
    }
  }
  cout << a[cur] << ' ';
  for (int i = 0; i < n; i++) {
    if (i != cur) {
      cout << a[i] << ' ';
    }
  }
}
int main() {
  solve();
  int n;
  cin >> n;
}
