AT_abc404_b [ABC404B] Grid Rotation

Description

There are two grids $ S $ and $ T $ , each with $ N $ rows and $ N $ columns. Let $ (i,j) $ denote the cell at the $ i $ -th row from the top and the $ j $ -th column from the left. Each cell of grids $ S $ and $ T $ is colored either white or black. Cell $ (i,j) $ of $ S $ is white if $ S_{i,j} $ is `.`, and black if $ S_{i,j} $ is `#`. The same applies to $ T $ . You may perform the following two types of operations any number of times in any order. Find the minimum number of operations required to make grid $ S $ identical to grid $ T $ . - Choose one cell of grid $ S $ and change its color. - Rotate the entire grid $ S $ $ 90 $ degrees clockwise.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ S_{1,1}S_{1,2}\dots S_{1,N} $ $ \vdots $ $ S_{N,1}S_{N,2}\dots S_{N,N} $ $ T_{1,1}T_{1,2}\dots T_{1,N} $ $ \vdots $ $ T_{N,1}T_{N,2}\dots T_{N,N} $

Output Format

Output the minimum number of operations required.

Explanation/Hint

### Sample Explanation 1 You can match $ S $ to $ T $ in two operations as shown below. ![Figure](https://cdn.luogu.com.cn/upload/vjudge_pic/AT_abc404_b/39401de8b1fe05c82f0504e58eff9ff5b7a54b8f67f511fac0837c369f38f1a9.png) ### Constraints - $ 1 \le N \le 100 $ - $ N $ is an integer. - Each of $ S_{i,j} $ and $ T_{i,j} $ is `.` or `#`.