Ribamko A.V.

In the lower left corner of a $n \times n$ chessboard, there is a knight. It is known that the minimum number of moves it takes for the knight to reach the upper right corner is equal to the minimum number of moves it takes to reach the lower right corner. Find $n$.

#
Let $n$ be even. In this case, the left lower field has the same color as the right upper one, while the right lower field has a different color. After each move, the knight lands on a field of the opposite color. Therefore, any path from the left lower corner to the right upper one consists of an even number of moves, while the path to the right lower corner consists of an odd number of moves. Consequently, their lengths are different.

: Let $n=4 k+1$. Then, by making moves alternately along the fields of the two lower rows, the knight will reach the right lower corner in $2 k$ moves.

We will show that the path to the right upper corner is longer. Each move shifts the knight by a total of 3 fields horizontally and vertically. Even moving consistently to the right-up, the knight will move a total of $6 k$ fields in $2 k$ moves. The total distance horizontally and vertically from the left lower corner to the right upper one is $2 n-2 = 8 k > 6 k$. Therefore, the shortest path to the right upper field is longer.

Let $n=4 k-1$. Then, the right lower field can be reached in $2 k$ moves as follows: the first move is one field to the right and two up, the second move is one field to the right and two down, and then, as in the previous case, move alternately along the fields of the two lower rows. It is impossible to reach the destination in fewer moves.

Indeed, the knight needs to move $n-1=4 k-2$ cells to the right, and each move can shift it a maximum of two cells to the right. Therefore, the number of moves is at least $2 k-1$. But after $2 k-1$ moves, the knight will land on a field of the opposite color, while in our case, the right lower corner has the same color as the left lower corner, so at least one more move is needed, meaning the number of moves is at least $2 k$.

The maximum total shift to the right and up in $2 k$ moves remains $6 k$. The total distance horizontally and vertically from the left lower field to the right upper one is $2 n-2 = 8 k-4$. For $k>2$, this is greater than $6 k$. For $k=1 (n=3)$, it is easy to check all options and see that this case does not work. However, for $k=2 (n=7)$, both shortest paths consist of four moves, and this is also easy to verify.

## Answer

$n=7$.