# 行ごと、列ごとにA数、B数を数えておき、あとは全マス全探索するか N = int(input()) S = [] for i in range(N): S.append(input()) A_row = [0]*N A_col = [0]*N #B_row = [0]*N #B_col = [0]*N for i in range(N): for j in range(N): if S[i][j] == 'A': A_row[i] += 1 A_col[j] += 1 #elif S[i][j] == 'B': # B_row[i] += 1 # B_col[j] += 1 ans = 0 for i in range(N): for j in range(N): if S[i][j] == '.': if A_row[i]==N-1: ans += 1 if A_col[j]==N-1: ans += 1 # ど真ん中チェック if N%2 == 1: # \方向 count_A = 0 dot_count = 0 for i in range(N): if S[i][i] == 'A': count_A += 1 elif S[i][i] == '.': dot_count += 1 if count_A == N-1 and dot_count == 1: ans += 1 # /方向 count_A = 0 dot_count = 0 for i in range(N): if S[i][N-1-i] == 'A': count_A += 1 elif S[i][i] == '.': dot_count += 1 if count_A == N-1 and dot_count == 1: ans += 1 print(ans)