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