N,M = map(int,input().split()) ans = 0 for _ in range(N): A = input() ans += M-A.count("R") print(ans)