#include #define rep(i,a,b) for(int i=int(a);i> H >> W; rep(i,0,H){ string S; cin >> S; rep(j,0,W){ if(S[j] == 'W')cnt++; } } cout << cnt << endl; }