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