Time limit
6s
Memory limit
128 MB
N^2 coins are placed on a table in an N by N grid. Each coin shows either heads, written as H, or tails, written as T. The figure below shows one possible state when N = 3.

In one operation, you may choose any row or any column and flip all N coins in it. For example, if the first column is flipped in Figure 1, the board becomes Figure 2. If the first row is then flipped, the board becomes Figure 3.
![]() | ![]() |
| <Figure 2> | <Figure 3> |
In Figure 3, exactly 2 coins show tails. Starting from Figure 1, no sequence of whole-row and whole-column flips can make fewer than 2 coins show tails.
Given the initial state, find the minimum possible number of coins showing tails after performing any number of row or column flip operations.
The first line contains a natural number N. N is at most 20.
Each of the next N lines gives one row of the initial board. Each line is a string of length N; from left to right, H means the coin shows heads and T means the coin shows tails. There are no spaces between characters.
Output the minimum possible number of coins showing tails after performing row or column flip operations.