XOR is a simple bitwise binary operator, su=imilar to AND and OR.
AND returns 1 if both inputs are one, and 0 in all other cases:
a b a & b
0 0 0
0 1 0
1 0 0
1 1 1
Similarly, OR returns 1 if any input is one, and 0 only when both are zero:
a b a | b
0 0 0
0 1 1
1 0 1
1 1 1
XOR is very similar: it returns 1 if both the inputs are different: one zero and one one. If they are the same, it returns 0:
a b a ^ b
0 0 0
0 1 1
1 0 1
1 1 0
Because these are bitwise operators, the return value is the "collection" of output bits: one for each pair of bits in the input.
So if your input is 52 XOR 31, you first think ot it as binary:
56 = 111000b
31 = 011111b
XOR them together and you get:
56 = 111000
31 = 011111
XOR ------
100111
Which doesn't look too useful at first glance.
But ... What if you XOR that result with either of the two inputs?
56 = 111000
?? = 100111
XOR ------
011111
31 = 011111
?? = 100111
XOR ------
111000
Which is the "other value" from the original operation!
So if
a ^ b = x
then
a ^ x = b
and
b ^ x = a
This is really useful, and it's basically what makes a RAID 5 drive work: you write
a
on one drive,
b
on the second, and
a ^ b
on the third. When any disk fails, the "missing information" can be rebuilt perfectly from the information on the remaining two!
So ... now think about your task, and try it manually with - say - five numbers: 1, 2, 3, 4, and 5. Remove two numbers at random, and see if you can make the algorithm work out what they were!
When you have that working, it should be pretty simple for you to code it.