using System; public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var s = new string[n]; for (int i = 0; i < n; i++) s[i] = Console.ReadLine().Trim(); getAns(n, s); } static void getAns(int n, string[] s) { var ans = 0; for (int i = 0; i < n; i++) { var ca = 0; var cd = 0; foreach (var x in s[i]) if (x == 'A') ca++; else if (x == '.') cd++; if (ca == n - 1 && cd == 1) ans++; } for (int i = 0; i < n; i++) { var ca = 0; var cd = 0; for (int j = 0; j < n; j++) { if (s[j][i] == 'A') ca++; else if (s[j][i] == '.') cd++; } if (ca == n - 1 && cd == 1) ans++; } var ca2 = 0; var cd2 = 0; var ca3 = 0; var cd3 = 0; for (int i = 0; i < n; i++) { if (s[i][i] == 'A') ca2++; else if (s[i][i] == '.') cd2++; if (s[i][n - 1 - i] == 'A') ca3++; else if (s[i][n - 1 - i] == '.') cd3++; } if (ca2 == n - 1 && cd2 == 1) ans++; if (ca3 == n - 1 && cd3 == 1) ans++; Console.WriteLine(ans); } }