import sys sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] # inf = 18446744073709551615 inf = 4294967295 md = 10**9+7 # md = 998244353 def rot90(aa): return [col[::-1] for col in zip(*aa)] def cnt1(aa): res = 0 for row in aa: if sum(row[:-1]) == n-1 or sum(row[1:]) == n-1: res += 1 return res def cnt2(aa): for i in range(n-1): if aa[i][0] == 0: return 0 res = 1 for row in aa[:-1]: if sum(row[1:]) == n-1: res += 1 if sum(aa[-1][:-1]) == n-1 or sum(aa[-1][1:]) == n-1: res += 1 return res n = II() aa = [[c == "." for c in SI()] for _ in range(n)] ans = 0 ans = max(ans, cnt1(aa)) aa = rot90(aa) ans = max(ans, cnt1(aa)) for _ in range(2): for _ in range(4): ans = max(ans, cnt2(aa)) aa = rot90(aa) aa = aa[::-1] print(ans)