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