#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef unsigned long long ull; typedef long long ll; #define REP(i,n) for(int (i) = 0; (i) < (n); ++(i)) #define FOR(i,a,b) for(int (i) = a; (i) < (b); ++(i)) int main () { int n; cin >> n; char s[110][110]; REP(i,n) cin >> s[i]; int r[110] = {0}; int h[110] = {0}; int x = 0, y = 0; REP(i,n) REP(j,n) { if (s[i][j] == '.') { } else if (s[i][j] == 'A') { r[i]++; h[j]++; if (i==j) x++; if (i+j==n-1) y++; } else { r[i]-= 1000; h[j]-= 1000; if (i==j) x-=1000; if (i+j==n-1) y-=1000; } } int ans = 0; REP(i,n) REP(j,n) if (s[i][j] == '.') { if (r[i] == n-1) ++ans; if (h[j] == n-1) ++ans; if (i==j && x==n-1) ++ans; if (i+j==n-1 && y==n-1) ++ans; } cout << ans << endl; }