XOR all elements. Result is where and are the two unique numbers.
Find any set bit in this XOR (the rightmost is easiest: xor & (-xor)).
This bit differs between and . Partition all numbers by this bit.
XOR within each group. One group gives , the other gives .