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.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class TaskD implements Runnable {
    
    long a[];
    int n, base;
    
    void gauss()
    {
        int cur = 0;
        for (long i = 62; i >= 0; --i)
        {
            int where = -1;
            for (int j = cur; j < n; ++j)
                if ((a[j] & (1l << i)) != 0)
                {
                    where = j;
                    break;
                }
    
            if (-1 == where) continue;
            
            long t = a[cur];
            a[cur] = a[where];
            a[where] = t;
            
            for (int j = 0; j < n; ++j)
                if (j != cur && 0 != (a[j] & (1l << i)))
                    a[j] ^= a[cur];
            ++cur;
        }
        
        base = cur;
    }
    
    int[] gauss(int a[][],int var,int equ) throws IOException
    {
        int r, c; 
        for (r = 0,c = 0;r<equ && c<var;r++, c++)       
        {               
            if (a[r][c] == 0)
            {
                for (int i=r+1;i<equ;i++)
                    
                if (a[i][c] != 0)
                {
                    for (int j=0;j<var+1;j++) {
                        int t = a[i][j];
                        a[i][j] = a[r][j];
                        a[r][j] = t;
                    }
                    
                    break;
                }       
            }
            if (a[r][c] == 0)                               
            { 
                r--; continue;
            }
            for (int i=0;i<equ;i++)                 
                if (i != r && a[i][c] != 0)
                {
                    for (int j=0;j<var+1;j++)
                        a[i][j] = a[i][j]^a[r][j];
                }
            
            
        }
        
        for (int i = r; i < equ; ++i) {
            if (a[i][var] != 0) {
                throw new IOException();
            }
        }
        
        int ret[] = new int[var];
        for (int i = 0; i < r; ++i) {
            for (int j = 0; j < var; ++j) {
                if (a[i][j] != 0) {
                    ret[j] = a[i][var];
                    break;
                }
            }
        }
           
        return ret;
    }

    boolean judge(int a[][],int var,int equ)
    {
        
        int r, c; 
        for (r = 0,c = 0;r<equ && c<var;r++, c++)       
        {               
            if (a[r][c] == 0)
            {
                for (int i=r+1;i<equ;i++)
                    
                if (a[i][c] != 0)
                {
                    for (int j=0;j<var+1;j++) {
                        int t = a[i][j];
                        a[i][j] = a[r][j];
                        a[r][j] = t;
                    }
                    
                    break;
                }       
            }
            if (a[r][c] == 0)                               
            { 
                r--; continue;
            }
            
            for (int i=0;i<equ;i++)                 
            if (i != r && a[i][c] != 0)
            {
                for (int j=0;j<var+1;j++)
                    a[i][j] = a[i][j]^a[r][j];
            }
            
            
        }
        
        for (int i=r;i<equ;i++)
            if (a[i][var] != 0) 
                return false;
            
        return true;
    }

    private boolean canBeExpressed(long base[], long mask, long v) {
        
        int a[][] = new int[63][base.length + 1];
        for (long i = 62; i >= 0; --i) { 
            
            if (0 == (mask & (1l << i))) {
                continue;
            }
            
            for (int j = 0; j < base.length; ++j) {
                if (0 != (base[j] & (1l << i))) {
                    a[(int)i][j] = 1;
                }
            }        
            
            if (0 != (v & (1l << i))) {
                a[(int)i][base.length] = 1;
            }
        }
        
        return judge(a, base.length, 63);
    }


    private void solve() throws IOException {
        n = nextInt();
        a = new long[n];
        
        long sum = 0;
        for (int i = 0; i < n; ++i) {
            a[i] = nextLong();
            sum ^= a[i];
        }
        
        long b[] = a.clone();
        
        gauss();
        long me = 0;
        
        long bases[] = new long[base];
        for (int i = 0; i < base; ++i) {
            bases[i] = a[i];
        }
        
        long currentMask = 0;
        
        for (long i = 62; i >= 0; --i) {
            if (0 != (sum & (1l << i))) {
                continue;
            }
            
            currentMask ^= 1l << i;
            
            if (canBeExpressed(bases, currentMask, me ^ (1l << i))) {
                me ^= 1l << i;
            }
        }
        
        for (long i = 62; i >= 0; --i) {
            if (0 == (sum & (1l << i))) {
                continue;
            }
            
            currentMask ^= 1l << i;
            
            if (!canBeExpressed(bases, currentMask, me)) {
                me ^= 1l << i;
            }
        }
        
        int a[][] = new int[63][n + 1];
        for (long i = 62; i >= 0; --i) {
            for (int j = 0; j < n; ++j) {
                if ((b[j] & (1l << i)) != 0)
                    a[(int)i][j] = 1;
            }
            
            if ((me & (1l << i)) != 0)
                a[(int)i][n] = 1;
        }
        
        int ans[] = gauss(a, n, 63);
        for (int i = 0; i < n; ++i) {
            if (i > 0) {
                writer.print(" ");
            }
            
            if (ans[i] == 1) {
                writer.print(1);
            } else {
                writer.print(2);
            }
        }
        
        writer.println();


    }

    public static void main(String[] args) {
        new TaskD().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}