#include using namespace std; typedef long long ll; int main(){ int h, w; cin >> h >> w; int ans = 0; string s; for (int i = 0; i < h; i++){ cin >> s; for (char x : s) if (x != 'R') ans++; } cout << ans << endl; }