#include #define rep(i, n) for (int i = 0; i < n; ++i) using ll = long long; using namespace std; const int INF = 1e9; int main() { int H, W; cin >> H >> W; ll ans = 0; rep(i, H) { string s; cin >> s; rep(j, s.size()) { if (s[j] != 'R') ++ans; } } cout << ans << endl; return 0; }