Possible Duplicate:
XOR properties in set of numbers
Say I have n positive numbers
$A_1$,$A_2$...$A_n$ and $A_k$ is minimum among them. And d
is a number such that ($A_1$-d) $\oplus$ ($A_2$-d) $\oplus$ .......(An-1-d) $\oplus$ ($A_n$-d) = 0 where 0<=d <= $A_k$ .
I want to know how many d
are there . I know I can iterate all possible value of d
and take XOR
of n
number every time and find out but complexity in this case is O($A_k*n$) which is O($n^2$) in worst case.
Is their any property of XOR
which can help us to find number of d
in less complexity than this ?