n,m = map(int,input().split()) cnt=0 for i in range(n): line = input() for j in line: if j != "R": cnt+=1 print(cnt)