On a $6 \times 6$ toy board, each cell represents a light button. When someone presses a button, it turns on if it is off and turns off if it is on. In addition, all buttons that share a side with a pressed button also change their state: from on to off or from off to on. Starting with all buttons off and pressing each button on the board once, one at a time and in any order, how many buttons will be on at the end?
Solution

Notice that a button will end up lit if it changes state an odd number of times and will end up off otherwise. Each button changes state when it or one of its neighbors is pressed, so the number of times it will change state will be equal to its number of neighbors plus one. We can thus analyze each cell of the board according to its number of neighbors:

i) The four corner cells each have two neighbors and will thus change state $1+$ $2=3$ times. They will end up lit.

ii) The cells that are on the sides but are not corners have three neighbors and will thus change state $1+3=4$ times. They will end up off.

iii) Each of the other cells that are not on the sides have four neighbors and will thus change state $1+4=5$ times. They will end up lit.

Finally, since the $6 \times 6$ board has 16 side cells that are not corners and these are the only ones that will end up off, we conclude that $36-16=20$ buttons will be lit at the end of the process.