Given a sequence of natural numbers, you can add any natural number to any number in the sequence such that their xor becomes zero. My goal is to minimize the sum of added numbers.
Consider the following examples :
For $1, 3$ the answer is $2$; adding $2$ to $1$ we get $3 \oplus 3=0$.
For $10, 4, 5, 1$ the answer is $6$; adding $3$ to $10$ and $3$ to $5$ we get $13 \oplus 4 \oplus 8 \oplus 1 = 0$.
For $4, 4$ the answer is $0$, since $4 \oplus 4 = 0$.
I tried working on binary representations of sequence number but it got so complex. I want to know if there is any simple and efficient way to solve this problem.