XOR and Favorite Number

CodeForces - 617E