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 JAVA):

Solution:
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter pw;

	static byte[][] grid;

	static int row;
	static int n;
	public static void main(String[] args) throws IOException	{
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		n = readInt();
		grid = new byte[62][n+1];
		long[] list = new long[n];
		loadArray(list);
		long finalxor = 0;
		for(long out: list)
			finalxor ^= out;
		row = 0;
		byte[] ret = new byte[n];
		for(int bit = 61; bit >= 0; bit--)	{
			if((finalxor & (1L << bit)) != 0)	{
				continue;
			}
			for(int k = 0; k < n; k++)	{
				if((list[k]&(1L<<bit)) != 0)	{
					grid[row][k] = 1;
				}
				else	{
					grid[row][k] = 0;
				}
			}
			grid[row][n] = 1;
			rref();
		}
		for(int bit = 61; bit >= 0; bit--)	{
			if((finalxor & (1L << bit)) == 0)	{
				continue;
			}
			for(int k = 0; k < n; k++)	{
				if((list[k]&(1L<<bit)) != 0)	{
					grid[row][k] = 1;
				}
				else	{
					grid[row][k] = 0;
				}
			}
			grid[row][n] = 0;
			rref();
		}
		Arrays.fill(ret, (byte)2);
		for(int i = 0; i < row; i++)	{
			if(grid[i][n] == 1)	{
				for(int j = 0; j < n; j++)	{
					if(grid[i][j] == 1)	{
						ret[j] = 1;
						break;
					}
				}
			}
		}
		pw.print(ret[0]);
		for(int i = 1; i < n; i++)	{
			pw.print(" " + ret[i]);
		}
		pw.println();
		pw.close();
	}

	public static void rref()	{
		int numRowsSeen = 0;
		boolean[] used = new boolean[row];
		for(int col = 0; col < n && numRowsSeen < row; col++)	{
			int myRow = -1;
			for(int i = 0; i < row; i++)	{
				if(grid[i][col] == 1 && !used[i])	{
					myRow = i;
					break;
				}
			}
			if(myRow == -1)
				continue;
			used[myRow] = true;
			for(int i = 0; i < row; i++)	{
				if(!used[i] && grid[i][col] == 1)	{
					throw new RuntimeException("WHAT");
				}
			}
			numRowsSeen++;
			if(grid[row][col] == 1)	{
				for(int k = 0; k <= n; k++)	{
					grid[row][k] ^= grid[myRow][k];
				}
			}
		}
		boolean nonZeroPresent = false;
		for(int i = 0; !nonZeroPresent && i < n; i++)	{
			nonZeroPresent = grid[row][i] == 1;
		}
		if(!nonZeroPresent)	{
			return;
		}
		int lowCol = 0;
		while(lowCol < grid[row].length && grid[row][lowCol] == 0)
			lowCol++;
		if(lowCol != grid[row].length)	{
			for(int i = 0; i < row; i++)	{
				if(grid[i][lowCol] == 1)	{
					for(int k = 0; k <= n; k++)	{
						grid[i][k] ^= grid[row][k];
					}
				}
			}
		}
		row++;
	}

	/* NOTEBOOK CODE */

	public static void loadArray(int[][] grid) throws IOException {
		for(int[] a: grid)
			loadArray(a);
	}

	public static void loadArray(int[] in) throws IOException {
		for(int i = 0; i < in.length; i++)
			in[i] = readInt();
	}

	public static void loadArray(long[] in) throws IOException {
		for(int i = 0; i < in.length; i++)
			in[i] = readLong();
	}


	private static long readLong() throws IOException	{
		return Long.parseLong(nextToken());
	}

	private static double readDouble() throws IOException	{
		return Double.parseDouble(nextToken());
	}

	private static int readInt() throws IOException	{
		return Integer.parseInt(nextToken());
	}

	private static String nextToken() throws IOException	{
		while(st == null || !st.hasMoreTokens())	{
			if(!br.ready())	{
				pw.close();
				System.exit(0);
			}
			st = new StringTokenizer(br.readLine().trim());
		}
		return st.nextToken();
	}
}