OPC-Abhiyanth 2015 Lucky and XOR

I would like to know why this solution works?
I would really appreciate any effort to make me understand.

http://www.codechef.com/viewsolution/6522211

Like addition, a xor (b xor c) = (a xor b) xor c

For the even part, for an array with even number of terms, when you make all possible sub-arrays, each number appears even number of times. And x xor x = 0 for all x. Hence, the answer is zero.

If the array has odd number of terms, then all the digits at even places occur twice and hence become 0.

My solution using the above logic: CodeChef: Practical coding for everyone