import copy N = int(input()) lsS = [list(input()) for i in range(N)] def rotate(ls): lens = len(ls) ret = [[0]*lens for i in range(lens)] for i in range(lens): for j in range(lens): ret[j][lens-1-i] = ls[i][j] return ret ans = 0 for i in range(4): ls2 = copy.deepcopy(lsS) cnt = 0 for j in range(1,N-1): if ls2[j][:-1].count('.') == N-1: cnt += 1 for k in range(N-1): ls2[j][k] = '#' if ls2[j][1:].count('.') == N-1: cnt += 1 for k in range(1,N): ls2[j][k] = '#' if ls2[0].count('#') == 0 and ls2[-1].count('#') == 0: cnt += 2 for k in range(N-1): ls2[0][k] = '#' ls2[-1][k+1] = '#' for j in range(N): cc = 0 for k in range(N): if ls2[k][j] == '#': cc += 1 if cc == 0: cnt += 1 if cc == 1 and (ls2[0][j] == '#' or ls2[-1][j] == '#'): cnt += 1 ans = max(ans, cnt) lsS = rotate(lsS) print(ans)