“ Fruit elimination ” It's a mobile game , I believe everyone has played or played similar games .
Here is “ Fruit elimination ” An initial state of the game .
Basic rules of elimination ： If there is 2 Or 2 More than one of the same fruits are linked together , You can click and eliminate .
In a certain state , There are several options that can be clicked and eliminated .
Enter an integer first n, Indicates that the total number of squares for fruit is n*n.n take 3 To 1000 Integer between （ contain 3 and 1000）.
Then type in n*n Data representing fruit , Different fruits are represented by different numbers , The same fruit is represented by the same number .
The number indicating the fruit is from 1 Start , No more than 100.
In the initial state corresponding to the input data , There are several options for clicking and eliminating .
The number of output schemes .
The sample input