Pusheen has received a present from her friend! It turns out to be a puzzle similar to the 15-puzzle.
The puzzle is an
Pusheen is getting started on this puzzle, and has it set to the Easy difficulty. On Easy difficulty, Pusheen is able to solve the puzzle by rotating exactly one subgrid by 90 degrees. Help Pusheen determine the size of the subgrid she should rotate.
Constraints
In tests worth 1 mark,
In additional tests worth 2 marks,
In additional tests worth 11 marks,
Input Specification
The first line of input is a single positive integer,
The next
Output Specification
Output, on a single line, the size of the subgrid Pusheen will rotate. It is guaranteed that this integer will be at least 2, and will be unique.
Sample Input
3
1 2 3
4 8 5
7 9 6
Sample Output
2
Comments