/* -*- coding: utf-8 -*- * * 2692.cc: No.2692 How Many Times Reached? - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 100; /* typedef */ /* global variables */ char ss[MAX_N][MAX_N + 4]; /* subroutines */ bool check(int n, int y, int x, int dy, int dx) { int a = 0, d = 0; for (int i = 0; i < n; i++) { if (ss[y][x] == 'A') a++; else if (ss[y][x] == '.') d++; y += dy, x += dx; } return (a == n - 1 && d == 1); } /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%s", ss[i]); int cnt = 0; for (int i = 0; i < n; i++) { if (check(n, i, 0, 0, 1)) cnt++; if (check(n, 0, i, 1, 0)) cnt++; } if (check(n, 0, 0, 1, 1)) cnt++; if (check(n, 0, n - 1, 1, -1)) cnt++; printf("%d\n", cnt); return 0; }