#include using namespace std; int main() { int n, m, ans = 0; string s; cin >> n >> m; while (n--) { cin >> s; ans += count_if(s.begin(), s.end(), [](char c) { return (c == 'W'); }); } cout << ans << endl; return 0; }