Expplain the Logic Please

I couldn’t understand the logic of problem http://www.codechef.com/DEC14/problems/XORSUB. Please help me out.