HW=input() HW=HW.rstrip().split(" ") H=int(HW[0]) W=int(HW[1]) count=0 for i in range(H): a=input() b=a.count("R") count+=b print(H*W-count)