#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :N].copy() def solve_vertical(S): H, W = S.shape cond_1 = np.all(S[:-1] == b'.', axis=0) cond_2 = np.all(S[1:] == b'.', axis=0) return np.count_nonzero(cond_1 | cond_2) def solve(S): yield solve_vertical(S) yield solve_vertical(S.T) for _ in range(2): S = S.T for _ in range(4): S = S[::-1].T if np.all(S[0, 1:] == b'.'): S[0, 1:] = b'#' for x in solve(S): yield x + 1 print(max(solve(S)))