## Solution.

Note that the order of execution of the steps is not important, so we can assume without loss of generality that we will first perform the steps by rows, and then by columns. Also note that no step needs to be performed more than once.

Consider what the initial coloring of the board must be in order to end up with a completely black board after a final sequence of steps. Since we will first apply the step by rows, and then by columns, we can observe that before applying the step by columns, all rows must be colored in the same way.

Therefore, we conclude that in the initial coloring, all rows must be colored in one of two possible ways that can be obtained from one another by applying a step.

If each row in the initial coloring contains at least two black squares, then the number of black squares is at least $2n$. Suppose there is a row that contains at most one black square. That row cannot be both the first and the last row because they have black squares in different columns. This means there is a row that is colored oppositely and contains at least $n-1$ black squares. If that row contains $n$ black squares, then both the first and the last row contain $n$ black squares, and the total number of black squares is at least $2n$. If that row contains exactly $n-1$ black squares, then in the remaining $n-1$ rows, there must be at least one black square each, so the total number of black squares is at least $2n-2$.

This shows that the total number of black squares at the beginning must be at least $2n-2$, i.e., we must color at least $2n-4$ additional squares.

On the other hand, if we color all squares except the last one in the first row and column black (as shown in the figure), then after a finite number of steps (on the first $n-1$ rows and the first $n-1$ columns), the entire board will be black. Therefore, the smallest number of squares that need to be additionally colored black is $2n-4$.
## Task 2.

On an $N \times N (N \geqslant 2)$ board, two diagonally opposite corner cells are colored black, and all other cells are colored white. In one step, we select a row or a column and change the color of each cell in that row or column from black to white and vice versa. What is the smallest additional number of cells that we must color black at the beginning so that after a finite number of such steps, we can obtain a board where all cells are black?