#include using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { int N; cin >> N; vector s(N); rep(i, N) cin >> s[i]; int ans = 0; rep(i, N) { int c = 0; rep(j, N) if(s[i][j] == 'A') c++; if(c == N - 1) ans++; } rep(j, N) { int c = 0; rep(i, N) if(s[i][j] == 'A') c++; if(c == N - 1) ans++; } int c = 0; rep(i, N) if(s[i][i] == 'A') c++; if(c == N - 1) ans++; c = 0; rep(i, N) if(s[N - 1 - i][i] == 'A') c++; if(c == N - 1) ans++; cout << ans << endl; }