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