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