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:
//package round153;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.BitSet;

public class D {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		int n = ni();
		long[] a = new long[n];
		for(int i = 0;i < n;i++){
			a[i] = nl();
		}
		
		long allx = 0;
		for(int i = 0;i < n;i++){
			allx ^= a[i];
		}
//		BasisAndCause bac = basisEx(a);
		
		long[] b = new long[n];
		long x1 = 0;
		
		for(int i = 61;i >= 0;i--){
			if(allx<<63-i>=0){
				for(int j = 0;j < n;j++){
					b[j] = b[j] * 2 + (a[j]>>>i&1);
				}
				long[] bas = basis(b);
				if(hasSolution(x1*2+1, 0, bas)){
					x1 = x1 * 2 + 1;
				}else{
					x1 = x1 * 2;
				}
			}
		}
		
		for(int i = 61;i >= 0;i--){
			if(allx<<63-i<0){
				for(int j = 0;j < n;j++){
					b[j] = b[j] * 2 + (a[j]>>>i&1);
				}
				long[] bas = basis(b);
				if(hasSolution(x1*2, 0, bas)){
					x1 = x1 * 2;
				}else{
					x1 = x1 * 2 + 1;
				}
			}
		}
		
		BasisAndCause bac = basisEx(b);
		BitSet bs = solution(x1, bac);
		for(int i = 0;i < n;i++){
			if(i > 0)out.print(" ");
			if(bs.get(i)){
				out.print(1);
			}else{
				out.print(2);
			}
		}
		out.println();
	}
	
	public static BitSet solution(long x, BasisAndCause bac)
	{
		int h = 63-Long.numberOfLeadingZeros(x);
		BitSet ret = new BitSet();
		while(x != 0){
			if(bac.bas[h] != 0){
				x ^= bac.bas[h];
				ret.xor(bac.cause[h]); // 重いなら計算後回しにするかも？
				h = 63-Long.numberOfLeadingZeros(x);
			}else{
				return null;
			}
		}
		return ret;
	}
	
	public static long[] basis(long[] a)
	{
		long[] bas = new long[64];
		for(long x : a){
			int h = 63-Long.numberOfLeadingZeros(x);
			while(x != 0){
				if(bas[h] != 0){
					x ^= bas[h];
					h = 63-Long.numberOfLeadingZeros(x);
				}else{
					bas[h] = x;
				}
			}
		}
		return bas;
	}
	
	public static BasisAndCause basisEx(long[] a)
	{
		long[] bas = new long[64];
		BitSet[] cause = new BitSet[64];
		int[] hist = new int[64];
		
		for(int i = 0;i < a.length;i++){
			long x = a[i];
			int h = 63-Long.numberOfLeadingZeros(x);
			int hp = 0;
			while(x != 0){
				if(bas[h] != 0){
					x ^= bas[h];
					hist[hp++] = h;
					h = 63-Long.numberOfLeadingZeros(x);
				}else{
					bas[h] = x;
					cause[h] = new BitSet();
					cause[h].set(i);
					for(int j = 0;j < hp;j++){
						cause[h].xor(cause[hist[j]]);
					}
				}
			}
		}
		BasisAndCause bac = new BasisAndCause();
		bac.bas = bas;
		bac.cause = cause;
		return bac;
	}
	
	public static class BasisAndCause
	{
		public long[] bas;
		public BitSet[] cause;
	}
	
	public static boolean hasSolution(long x, int shift, long[] bas)
	{
		int h = 63-Long.numberOfLeadingZeros(x);
		while(x != 0){
			if(bas[h+shift]>>>shift != 0){
				x ^= bas[h+shift]>>>shift;
				h = 63-Long.numberOfLeadingZeros(x);
			}else{
				return false;
			}
		}
		return true;
	}
	
	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception
	{
		new D().run();
	}
	
	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}
			
			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}
	
	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}
			
			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}
	
	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}
	
	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}
	
	
	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}