The XOR
works because every time you XOR
a bit with 1
you flip it, and every time you XOR
a bit with 0
it stays the same. So the result of XOR
ing all the data save the missing number gives you the 'negative' impression of XOR
ing all the numbers. XOR
ing these two together restores your lost number.