func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX_N = 55;   int n, m, dp[MAX_N][MAX_N][MAX_N][MAX_N];   char a[MAX_N][MAX_N];   int dfs(int x1, int y1, int x2, int y2) {     if (dp[x1][y1][x2][y2] >= 0) {       return dp[x1][y1][x2][y2];     }     if (x1 == x2 && y1 == y2) {       return dp[x1][y1][x2][y2] = a[x1][y1] ==  # ;     }     int &ans = dp[x1][y1][x2][y2];     ans = max(x2 - x1 + 1, y2 - y1 + 1);     for (int i = x1; i < x2; ++i) {       ans = min(ans, dfs(x1, y1, i, y2) + dfs(i + 1, y1, x2, y2));     }     for (int j = y1; j < y2; ++j) {       ans = min(ans, dfs(x1, y1, x2, j) + dfs(x1, j + 1, x2, y2));     }     return ans;   }   int main() {     scanf( %d , &n);     memset(dp, -1, sizeof dp);     for (int i = 1; i <= n; ++i) {       scanf( %s , a[i] + 1);     }     printf( %d n , dfs(1, 1, n, n));   }   