[ Coloring

Given an $n \times n$ square. Initially, its cells are colored in white and black in a checkerboard pattern, with at least one of the corner cells being black. In one move, it is allowed to simultaneously recolor the four cells in some $2 \times 2$ square according to the following rule: each white cell is painted black, each black cell is painted green, and each green cell is painted white. For which $n$ can one obtain a checkerboard pattern where black and white colors have swapped places after several moves?

#
Suppose we managed to repaint the cells as required by the problem. We will call cells of the first type those that were originally white, and cells of the second type those that were black. Note that if a cell is repainted three times, it does not change its color in the end. Therefore, for a cell of the first type to become black, it needs to be repainted $3k+1$ times for some integer $k$ (for different cells, $k$ can be different). This means that if $a$ is the number of cells of the first type, then the total number of repaintings of these cells is $3K+a$ for some integer $K$. To make a cell of the second type white, it needs to be repainted $3m+2$ times. This means that if $b$ is the number of cells of the second type, then the total number of repaintings of these cells is $3M+2b$.

In each $2 \times 2$ square, there are an equal number of cells of the first and second types. Therefore, the total number of repaintings of cells of the first and second types will be the same, that is, $3K+a=3M+2b$. From this, $n^2=a+b$ is divisible by 3. Therefore, $n$ is also divisible by 3.

It remains to show how to repaint a square with a side length divisible by 3. Cut it into $3 \times 3$ squares. Consider one of these squares. There are two cases - either the corner cells are white, or they are black. In the first case, repaint each of the four squares adjacent to the corners once, and in the second case, twice. It is easy to verify that with such repainting, the chessboard coloring will change to the opposite.

## Answer

For all $n$ divisible by 3.