Problem

Source: Peru IMO TST 2016 p11

Tags: combinatorics



Let $n> 2$ be an integer. A child has $n^2$ candies, which are distributed in $n$ boxes. An operation consists in choosing two boxes that together contain an even number of candies and redistribute the candy from those boxes so that both contain the same amount of candy. Determine all the values of $n$ for which the child, after some operations, can get each box containing $n$ candies, no matter which the initial distribution of candies is.