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