#include using namespace std; int main(void) { int n, m; cin >> n >> m; string s; int cnt = 0; for (int i = 0; i < n; ++i) { cin >> s; for (int j = 0; j < m; ++j) { if (s[j] == 'W') ++cnt; } } cout << cnt << endl; return 0; }