IMO 1988 LL SWE78

A two-person game is played with nine boxes arranged in a

IMO 1988 LL SWE78

Origin: SWE

Problem

A two-person game is played with nine boxes arranged in a 3 \times 3 square, initially empty, and with white and black stones. At each move a player puts three stones, not necessarily of the same color, in three boxes in either a horizontal or a vertical row. No box can contain stones of different colors: If, for instance, a player puts a white stone in a box containing black stones, the white stone and one of the black stones are removed from the box. The game is over when the center box and the corner boxes each contain one black stone and the other boxes are empty. At one stage of the game x boxes contained one black stone each and the other boxes were empty. Determine all possible values of x.