QCJ3 SPOJ doubt

Why are we taking Xor of index with odd coins? I got this much that even coin index won’t contribute. And odd coin index will contribute but why are we taking XOR of them