n,m = map(int,input().split()) ret = 0 for _ in range(n): s = input() ret += s.count('R') print(ret)