#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0; i=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector VI; typedef vector VL; typedef vector VVL; typedef vector VVI; typedef pair P; typedef pair PL; int calc2(vector s){ int n = s.size(); REP(i,n-1) if (s[i][n-1] == '#') return 0; int ret = 1; REP(i,n){ int ok = 1; REP(j,n-1) if (s[i][j] == '#') ok = 0; ret += ok; } return ret; } int calc(vector s){ int n = s.size(); int ret = 0; REP(i,n){ bool ok = true; FOR(j,1,n-2) if (s[i][j] == '#') ok = false; if (!ok) continue; if (s[i][0] == '.' || s[i][n-1] == '.') ret++; } ret = max(ret, calc2(s)); reverse(ALL(s)); ret = max(ret, calc2(s)); reverse(ALL(s)); REP(i,n) reverse(ALL(s[i])); ret = max(ret, calc2(s)); reverse(ALL(s)); ret = max(ret, calc2(s)); bool ok = true; REP(i,n) if (s[i][0] == '#' || s[i][n-1] == '#') ok = false; REP(j,n) if (s[0][j] == '#' || s[n-1][j] == '#') ok = false; if (ok) ret = max(ret, 4); return ret; } int main() { int n; cin >> n; vector s(n); REP(i,n) cin >> s[i]; vector t(n, string(n, '.')); REP(i,n){ REP(j,n) t[i][j] = s[j][i]; } cout << max(calc(s), calc(t)) << endl; return 0; }