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;
const long long mod = 1e9 + 7;
const int maxn = 100005;
inline long long read() {
  long long res, ok = 1;
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') ok = -1;
  res = ch - '0';
  for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
    res = res * 10 + ch - '0';
  return res * ok;
}
int n, num, f[70], ans[maxn], dis[maxn], tot, last[maxn], ans1, s, t;
long long a[maxn], sum;
bool vis[maxn];
queue<int> q;
struct edge {
  int u, v, last, w;
} e[maxn << 1];
bitset<maxn> p[70];
inline int spfa() {
  memset(dis, 127, sizeof(dis));
  dis[s] = 0;
  q.push(s);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    vis[x] = false;
    for (int i = last[x]; i; i = e[i].last) {
      int v = e[i].v;
      if (dis[v] > dis[x] + e[i].w) {
        if (!vis[v]) q.push(v);
        dis[v] = dis[x] + e[i].w;
        vis[i] = true;
      }
    }
  }
  return dis[t];
}
inline int work(int x, int f) {
  if (x == t) return f;
  int num = f;
  for (int i = last[x]; i; i = e[i].last) {
    int v = e[i].v;
    if (dis[v] != dis[x] + 1) continue;
    int now = work(v, min(e[i].v, num));
    e[i].w -= now;
    e[i ^ 1].w += now;
    num -= now;
  }
  if (num == f) {
    dis[x] = -1;
    return 0;
  }
  return f - num;
}
inline bool bfs() {
  memset(dis, -1, sizeof(dis));
  dis[s] = 0;
  q.push(s);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = last[x]; i; i = e[i].last) {
      int v = e[i].v;
      if (dis[v] == -1) {
        dis[v] = dis[x] + 1;
        q.push(v);
      }
    }
  }
  return dis[t] == -1;
}
inline void dinic() {
  while (!bfs()) ans1 += work(s, 1 << 30);
}
int main() {
  n = read();
  for (int i = 0; i < n; i++) {
    a[i] = read();
    sum ^= a[i];
  }
  for (int i = 62; i >= 0; i--)
    if (~sum & (1LL << i)) {
      for (int j = 0; j < n; j++) p[num][j] = (a[j] & (1LL << i)) ? 1 : 0;
      num++;
    }
  for (int i = 62; i >= 0; i--)
    if (sum & (1LL << i)) {
      for (int j = 0; j < n; j++) p[num][j] = (a[j] & (1LL << i)) ? 1 : 0;
      num++;
    }
  for (int i = 0; i < num; i++) {
    p[i][n] = 1;
    for (int j = 0; j < i; j++)
      if (f[j] != n && p[i][f[j]]) p[i] ^= p[j];
    for (f[i] = 0; f[i] < n && p[i][f[i]] == 0; f[i]++)
      ;
    if (f[i] != n) {
      for (int j = 0; j < i; j++)
        if (p[j][f[i]]) p[j] ^= p[i];
    }
  }
  for (int i = 0; i < n; i++) ans[i] = 1;
  for (int i = 0; i < num; i++)
    if (f[i] != n) ans[f[i]] = p[i][n] ? 2 : 1;
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}