This property might come in hand(this is similar to XOR but kinda extended):
-
XOR of two numbers where both have even/odd set bit count => Output has even set bits.
Example: x = 3 (011) [HAS 2 SET BITS] y = 15 (1111) [HAS 4 SET BITS] Both have even SET bits. Their XOR is 12 (1100). It have even bits. -
XOR of two numbers where both have different number of set bit(one has even bit and another has odd bits) => Output has odd set bits.