#include using namespace std; int main() { int n; cin >> n; vector ss(n); for(auto &&s : ss) { cin >> s; } int cnt = 0; int nana0 = 0, nana1 = 0; for(int i = 0; i < n; i++) { int tate = 0, yoko = 0; for(int j = 0; j < n; j++) { if(ss[i][j] == '.') tate++; else if(ss[i][j] == 'B') tate = -1e9; if(ss[j][i] == '.') yoko++; else if(ss[j][i] == 'B') yoko = -1e9; } if(tate == 1) cnt++; if(yoko == 1) cnt++; if(ss[i][i] == '.') nana0++; else if(ss[i][i] == 'B') nana0 = -1e9; if(ss[i][n-i-1] == '.') nana1++; else if(ss[i][n-i-1] == 'B') nana1 = -1e9; } if(nana0 == 1) cnt++; if(nana1 == 1) cnt++; cout << cnt << endl; return 0; }