// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int n;
	cin >> n;
	vector<string> a(n);
	copy_n(istream_iterator<string>(cin), n, a.begin());
	int res = 0;
	for(auto i = 0; i < n; ++ i){
		int cnt = 0;
		for(auto j = 0; j < n; ++ j){
			if(a[i][j] == 'B'){
				goto FAIL0;
			}
			cnt += a[i][j] == '.';
			if(cnt >= 2){
				goto FAIL0;
			}
		}
		++ res;
		FAIL0:;
	}
	for(auto j = 0; j < n; ++ j){
		int cnt = 0;
		for(auto i = 0; i < n; ++ i){
			if(a[i][j] == 'B'){
				goto FAIL1;
			}
			cnt += a[i][j] == '.';
			if(cnt >= 2){
				goto FAIL1;
			}
		}
		++ res;
		FAIL1:;
	}
	{
		int cnt = 0;
		for(auto i = 0; i < n; ++ i){
			if(a[i][i] == 'B'){
				goto FAIL2;
			}
			cnt += a[i][i] == '.';
			if(cnt >= 2){
				goto FAIL2;
			}
		}
		++ res;
		FAIL2:;
	}
	{
		int cnt = 0;
		for(auto i = 0; i < n; ++ i){
			if(a[i][n - 1 - i] == 'B'){
				goto FAIL3;
			}
			cnt += a[i][n - 1 - i] == '.';
			if(cnt >= 2){
				goto FAIL3;
			}
		}
		++ res;
		FAIL3:;
	}
	cout << res << "\n";
	return 0;
}

/*

*/