#include #define rep(i,n) for(int i=0;i=0;i--) #define FOR(i,m,n) for(int i=m;i inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } //const ll INF = 1LL << 60; //const int INF = 1001001001; const ll mod = 1000000007; int main(void){ int n,m; cin >> n >> m; int ans=0; rep(i,n)rep(j,m){ char a; cin >> a; if(a=='W') ans++; } cout << ans << endl; return 0; }