#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define Ma_PI 3.141592653589793 #define eps 0.00000001 #define LONG_INF 3000000000000000000 #define GOLD 1.61803398874989484820458 #define MAX_MOD 1000000007 #define REP(i,n) for(long long i = 0;i < n;++i) #define seg_size 524288 int grid[100][100] = {}; int n; int tate_can_do(int x, int y) { if (x >= 2) return 0; for (int q = 0;q < n - 1;++q) { if (grid[x + q][y] == 1) return 0; } return 1; } int yoko_can_do(int x, int y) { if (y >= 2) return 0; for (int q = 0;q < n - 1;++q) { if (grid[x][y+q] == 1) return 0; } return 1; } int main() { cin >> n; REP(i, n) { string s; cin >> s; for (int q = 0;q < s.length();++q) { if (s[q] == '#') grid[i][q] = 1; } } long long ans = 0; for (int turn = 0;turn < 10;++turn) { if (tate_can_do(0, 0) == 1) { if (yoko_can_do(n - 1, 0) == 1) { long long tate = 0; for (int q = 1;q < n-1;++q) { tate += tate_can_do(0, q); } tate += max(tate_can_do(0, n - 1), tate_can_do(1, n - 1)); long long yoko = 0; for (int q = 0;q < n - 1;++q) { yoko += yoko_can_do(q, 1); } ans = max({ ans,yoko+2,tate+2 }); if (tate_can_do(1, n - 1) == 1 && yoko_can_do(0, 1) == 1) { ans = max(ans, 4LL); } } if (yoko_can_do(n - 1, 1) == 1) { long long tate = 0; for (int q = 1;q < n;++q) { tate += tate_can_do(0, q); } long long yoko = 0; for (int q = 0;q < n - 1;++q) { yoko += yoko_can_do(q, 1); } ans = max({ ans,yoko+2,tate+2 }); } long long tate = 0; for (int q = 1;q < n;++q) { tate += max(tate_can_do(0, q),tate_can_do(1,q)); } long long yoko = 0; for (int q = 0;q < n - 1;++q) { yoko += yoko_can_do(q, 1); } ans = max({ ans,yoko+1,tate+1}); } if (tate_can_do(1, 0) == 1) { if (yoko_can_do(n-1,1) == 1) { long long tate = 0; long long yoko = 0; for (int q = 1;q < n;++q) { tate += tate_can_do(0, q); } for (int q = 1;q < n - 1;++q) { yoko += yoko_can_do(q, 1); } yoko += max(yoko_can_do(0, 0), yoko_can_do(0, 1)); ans = max({ ans,yoko + 2,tate + 2}); } long long tate = 0; long long yoko = 0; for (int q = 1;q < n;++q) { tate += max(tate_can_do(0, q), tate_can_do(1, q)); } for (int q = 1;q < n;++q) { yoko += yoko_can_do(q, 1); } yoko += max(yoko_can_do(0, 0), yoko_can_do(0, 1)); ans = max({ ans,yoko + 1,tate + 1 }); } long long tate = 0, yoko = 0; for (int q = 0;q < n;++q) { tate += max(tate_can_do(0, q),tate_can_do(1,q)); } for (int q = 0;q < n;++q) { yoko += max(yoko_can_do(q,0),yoko_can_do(q, 1)); } ans = max({ ans,yoko,tate }); int copy_grid[100][100] = {}; for (int t = 0;t < n;++t) { for (int q = 0;q < n;++q) { copy_grid[q][n-t-1] = grid[t][q]; } } for (int t = 0;t < n;++t) { for (int q = 0;q < n;++q) { grid[t][q] = copy_grid[t][q]; } } } cout << ans << endl; return 0; }