n, m = map(int, input().split()) ans = 0 for i in range(n): s = input() for c in s: if c != 'R': ans += 1 print(ans)