import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; import java.util.Scanner; public class Main { void run() { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); char[][] s = new char[N][N]; for (int i = 0; i < N; ++i) { s[i] = sc.next().toCharArray(); } int ans = 0; { boolean f = true; for (int i = 0; i < N; ++i) { for (int j = 0; j < N; ++j) { if (i == 0 || i == N - 1 || j == 0 || j == N - 1) { f &= s[i][j] == '.'; } } } if (f) ans = 4; } for (int t = 0; t < 2; ++t) { ans = Math.max(solve(s), ans); for (int i = 0; i < N; ++i) { for (int j = i + 1; j < N; ++j) { char tmp = s[i][j]; s[i][j] = s[j][i]; s[j][i] = tmp; } } } System.out.println(ans); } int solve(char[][] s) { int N = s.length; int ret = 0; for (int i = 0; i < N; i += N - 1) { for (int d = 0; d <= 1; ++d) { char[][] s2 = new char[N][N]; for (int j = 0; j < N; ++j) for (int k = 0; k < N; ++k) s2[j][k] = s[j][k]; boolean flag = true; ret = Math.max(ret, go(s2)); for (int j = d; j < N - 1 + d; ++j) { flag &= s2[i][j] == '.'; s2[i][j] = '#'; } ret = Math.max(ret, (flag ? 1 : 0) + go(s2)); } } return ret; } int go(char[][] s) { int ret = 0; int N = s.length; for (int i = 0; i < N; ++i) { boolean flag = true; for (int j = 1; j < N - 1; ++j) { flag &= s[j][i] == '.'; } if (flag && (s[0][i] == '.' || s[N - 1][i] == '.')) { ++ret; } } return ret; } public static void main(String[] args) { new Main().run(); } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } void show(char[][] s) { int N = s.length; for (int i = 0; i < N; ++i) { for (int j = 0; j < N; ++j) { System.out.print(s[i][j]); } System.out.println(); } } }