#abc233g. [abc233_g]Strongest Takahashi

[abc233_g]Strongest Takahashi

Problem Statement

There is a NtimesNN \\times N grid, with blocks on some squares.
The grid is described by NN strings S1,S2,dots,SNS_1,S_2,\\dots,S_N, as follows.

  • If the jj-th character of SiS_i is #, there is a block on the square at the ii-th row from the top and jj-th column from the left.
  • If the jj-th character of SiS_i is ., there is not a block on the square at the ii-th row from the top and jj-th column from the left.

Takahashi can do the operation below zero or more times.

  • First, choose an integer DD between 11 and NN (inclusive), and a DtimesDD \\times D subsquare within the grid.
  • Then, consume DD stamina points to destroy all blocks within the subsquare.

Find the minimum number of stamina points needed to destroy all the blocks.

Constraints

  • NN is an integer.
  • 1leNle501 \\le N \\le 50
  • SiS_i consists of # and ..
  • Si=N|S_i|=N

Input

Input is given from Standard Input in the following format:

NN S1S_1 S2S_2 vdots\\vdots SNS_N

Output

Print the answer as an integer.


Sample Input 1

5
##...
.##..
#.#..
.....
....#

Sample Output 1

4

By choosing the subsquares below, Takahashi will consume 44 stamina points, which is optimal.

  • The 3times33 \\times 3 subsquare whose top-left square is at the 11-st row from the top and 11-st column from the left.
  • The 1times11 \\times 1 subsquare whose top-left square is at the 55-th row from the top and 55-th column from the left.

Sample Input 2

3
...
...
...

Sample Output 2

0

There may be no block on the grid.


Sample Input 3

21
.....................
.....................
...#.#...............
....#.............#..
...#.#...........#.#.
..................#..
.....................
.....................
.....................
..........#.....#....
......#..###.........
........#####..#.....
.......#######.......
.....#..#####........
.......#######.......
......#########......
.......#######..#....
......#########......
..#..###########.....
.........###.........
.........###.........

Sample Output 3

19