n,m=map(int,input().split()) ans=0 for i in range(n): a=input() ans+=len(a)-a.count("R") print(ans)