#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  vector<vector<int>> tab(35);
  int N;
  cin >> N;
  vector<int> inp(N);
  int x;
  for (int i = 0; i < N; ++i) {
    cin >> x;
    inp[i] = x;
    int y = x;
    int j = 0;
    while (y != 0) {
      if (y % 2 == 1) tab[j].push_back(x);
      ++j;
      y /= 2;
    }
  }
  for (int i = tab.size() - 1; i >= 0; --i)
    if (tab[i].size() == 1) {
      x = tab[i][0];
      break;
    }
  cout << x;
  bool b = true;
  for (int y : inp)
    if (y == x && b)
      b = false;
    else
      cout << ' ' << y;
}
