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.io.BufferedReader;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.List;
import java.util.BitSet;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD_2Sets solver = new TaskD_2Sets();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD_2Sets {

    public static final int MAX_BIT = 60;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        long[] a = new long[n];
        long xorA = 0;
        for (int i = 0; i < n; ++i) {
            a[i] = in.nextLong();
            xorA ^= a[i];
        }
        List<Equation> equations = new ArrayList<Equation>();
        for (int eq = 0; eq <= 1; ++eq) {
            boolean e = (eq == 1);
            for (int bit = MAX_BIT; bit >= 0; --bit) {
                if (BitUtils.checkBit(xorA, bit) == e) {
                    // try to put it on both
                    BitSet set = new BitSet(n + 1);
                    set.set(n, !e);
                    for (int i = 0; i < n; ++i) {
                        if (BitUtils.checkBit(a[i], bit)) {
                            set.set(i, true);
                        }
                    }
                    if (!gaussIter(n, equations, set)) {
                        set = new BitSet(n + 1);
                        set.set(n, e);
                        for (int i = 0; i < n; ++i) {
                            if (BitUtils.checkBit(a[i], bit)) {
                                set.set(i, true);
                            }
                        }
                        if (!gaussIter(n, equations, set)) {
                            throw new AssertionError("!");
                        }
                    }
                }
            }
        }
        int[] res = new int[n];
        Arrays.fill(res, 2);
        for (Equation e : equations) {
            if (e.row.get(n)) {
                res[e.bit] = 1;
            }
        }
        out.println(ArrayUtils.toString(res));
    }

    private boolean gaussIter(int n, List<Equation> equations, BitSet set) {
        for (Equation e : equations) {
            if (set.get(e.bit)) {
                set.xor(e.row);
            }
        }
        if (set.cardinality() == 1 && set.get(n)) {
            return false;
        }
        if (set.cardinality() == 0) {
            return true;
        }
        int bitId = set.nextSetBit(0);
        for (Equation e : equations) {
            if (e.row.get(bitId)) {
                e.applyRow(set);
            }
        }
        equations.add(new Equation(bitId, set));
        return true;
    }

    class Equation {
        int bit;
        BitSet row;

        public Equation(int bit, BitSet row) {
            this.bit = bit;
            this.row = row;
        }

        void applyRow(BitSet rowToApply) {
            row.xor(rowToApply);
        }
    }

}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

    public long nextLong() {
        return Long.parseLong(nextString());
    }

}

class BitUtils {

    public static boolean checkBit(long mask, int bit) {
        return (mask & (1L << bit)) > 0;
    }
}

class ArrayUtils {

    public static String toString(int[] a) {
        StringBuilder result = new StringBuilder("");
        for (int x : a) result.append(x).append(' ');
        return result.substring(0, result.length()-1);
    }

}