A snake in an n×nn \times n grid is a path composed of straight line segments between centres of adjacent cells, going through the centres of all the n2n^2 grid cells, which visits each cell exactly once. Here two grid cells are considered to be adjacent if they share an edge. Note that all pieces of the snake path are parallel to grid lines. The figure shows an example of a snake in a 4×44 \times 4 grid. This snake makes nine 9090^\circ turns, marked by small black squares.

figure

Let us now consider a snake through the 2025 cells of a 45×4545 \times 45 grid. What is the maximum possible number of 9090^\circ turns that such a snake can make?