Problem: Little Petya likes numbers a lot. Recently his mother has presented him a collection of n non-negative integers. There's only one thing Petya likes more than numbers: playing with little Masha. He immediately decided to give a part of his new collection to her. To make the game even more interesting, Petya decided to give Masha such collection of numbers for which the following conditions fulfill:

  * Let's introduce x1 to denote the xor of all numbers Petya has got left; and let's introduce x2 to denote the xor of all numbers he gave to Masha. Value (x1 + x2) must be as large as possible. 
  * If there are multiple ways to divide the collection so that the previous condition fulfilled, then Petya minimizes the value x1. 



The xor operation is a bitwise excluding "OR", that is denoted as "xor" in the Pascal language and "^" in C/C++/Java.

Help Petya divide the collection as described above. If there are multiple suitable ways to divide it, find any of them. Please note that after Petya gives a part of his numbers to Masha, he may have no numbers left. The reverse situation is also possible, when Petya gives nothing to Masha. In both cases we must assume that the xor of an empty set of numbers equals 0.

Input

The first line contains integer n (1 ≤ n ≤ 105), showing how many numbers Petya's mother gave him. The second line contains the actual space-separated numbers. They are all integer, non-negative and do not exceed 1018.

Output

Print n space-separated integers, the i-th of them should equal either 1, if Petya keeps the number that follows i-th in his collection, or it should equal 2, if Petya gives the corresponding number to Masha. The numbers are indexed in the order in which they are given in the input.

Examples

Input

6
1 2 3 4 5 6


Output

2 2 2 2 2 2


Input

3
1000000000000 1000000000000 1000000000000


Output

2 2 2


Input

8
1 1 2 2 3 3 4 4


Output

1 2 1 2 2 2 1 2

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e5) + 17;
int n;
ll X;
ll a[MAXN];
int pos[MAXN];
bitset<1 << 17> s[62];
bool read() {
  if (!(cin >> n)) return false;
  for (ll i = 0; i < (ll)(n); ++i) cin >> a[i];
  return true;
}
bool gauss(vector<int>& p, ll x) {
  for (int b = 0; b < static_cast<int>((p).size()); ++b) {
    for (ll i = 0; i < (ll)(n); ++i) s[b][i] = ((a[i] >> p[b]) & 1);
    s[b][n] = ((x >> p[b]) & 1);
  }
  fill(pos, pos + n, -1);
  for (int i = 0, j = 0; i < static_cast<int>((p).size()) && j < n; ++j) {
    for (int i1 = i; i1 < static_cast<int>((p).size()); ++i1)
      if (s[i1][j] == 1) {
        swap(s[i], s[i1]);
        break;
      }
    if (s[i][j] != 0) {
      for (int i1 = 0; i1 <= static_cast<int>((p).size()); ++i1)
        if (i1 != i && s[i1][j] == 1) s[i1] ^= s[i];
      pos[j] = i++;
    }
  }
  for (ll i = 0; i < (ll)(n); ++i)
    if (pos[i] != -1 && s[pos[i]][n]) x ^= a[i];
  for (int b = 0; b < static_cast<int>((p).size()); ++b)
    if ((x >> p[b]) & 1) return false;
  return true;
}
void solve() {
  for (ll i = 0; i < (ll)(n); ++i) X ^= a[i];
  ll ans = 0;
  for (int bit = 60; bit >= 0; --bit)
    if (((X >> bit) & 1) ^ 1) {
      vector<int> p;
      for (int b = 60; b >= bit; --b)
        if (((X >> b) & 1) ^ 1) p.push_back(b);
      if (gauss(p, (ans | (1ll << bit)))) ans |= (1ll << bit);
    }
  for (int bit = 60; bit >= 0; --bit)
    if ((X >> bit) & 1) {
      vector<int> p;
      for (int b = 60; b >= 0; --b)
        if ((((X >> b) & 1) ^ 1) || b >= bit) p.push_back(b);
      if (!gauss(p, ans)) ans |= (1ll << bit);
    }
  vector<int> p(61);
  iota(p.begin(), p.end(), 0);
  reverse(p.begin(), p.end());
  gauss(p, ans);
  for (ll i = 0; i < (ll)(n); ++i)
    if (pos[i] != -1 && s[pos[i]][n])
      cout << 1 << ' ';
    else
      cout << 2 << ' ';
  cout << '\n';
}
int main() {
  cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');
  while (read()) solve();
  return 0;
}