n, m = map(int, input().split()) s = [input() for i in range(n)] ans = 0 for i in range(n): s[i] = s[i].replace("R", "") ans += len(s[i]) print(ans)