Given an array of N integers, you need to find out the minimum number of integers that must be added to the array such that for each integer of the array, there is at least one other integer in the array such that their bitwise XOR is 0.
The first line of the input contains a number N (1 ≤ N ≤ 105) denoting the size of the array. The next line contains N space separated positive integers, Ai (0 ≤ Ai ≤ 109) denoting the integers of the array.
In a single line, print the minimum number of integers that must be added to the array.
3 5 2 5
4 8 3 1 8
Here is the XOR table if you are not familiar with it:
|x||y||x XOR y|
While computing the XOR value of two numbers, each bit of the output will be the XOR of the corresponding bits of those two numbers. In most programming language (including C, C++, Python and Java), bitwise XOR operator is denoted by "^" (without the quote). So if you have two numbers called x and y, their bitwise XOR will be denoted by x^y.
Login to submit
The XOR value of two numbers can only be 0 if the numbers are same. Therefore, all you have to do is...