N = int(input()) S = [] S_ = [[] for _ in range(N)] for _ in range(N): tmp = [] for i, c in enumerate(input()): tmp.append(c) S_[i].append(c) S.append(tmp) num1 = 0 edge = S_[N - 1] for i, row in enumerate(S): if '#' not in row[:N - 1]: num1 += 1 elif '#' not in row[1:]: num1 += 1 edge[i] = '#' if '#' not in edge[:N - 1] or '#' not in edge[1:]: num1 += 1 # print(num1) num2 = 0 edge = S_[0] for i, row in enumerate(S): if '#' not in row[1:]: num2 += 1 elif '#' not in row[:N - 1]: num2 += 1 edge[i] = '#' if '#' not in edge[:N - 1] or '#' not in edge[1:]: num2 += 1 # print(num2) num3 = 0 edge = S[N - 1] for i, row in enumerate(S_): if '#' not in row[:N - 1]: num3 += 1 elif '#' not in row[1:]: num3 += 1 edge[i] = '#' if '#' not in edge[:N - 1] or '#' not in edge[1:]: num3 += 1 # print(num3) num4 = 0 edge = S[0] for i, row in enumerate(S_): if '#' not in row[1:]: num4 += 1 elif '#' not in row[:N - 1]: num4 += 1 edge[i] = '#' if '#' not in edge[:N - 1] or '#' not in edge[1:]: num4 += 1 # print(num4) print(max(num1, num2, num3, num4))