#coding:utf-8 n=[int(i) for i in input().split()] count=0 for i in range(n[0]): s=input() for j in range(n[1]): if(s[j]!='R'): count+=1 print(count)