h,w = map(int,input().split()) count=0 for i in range(h): s = list(input()) for si in s: if si!="R": count+=1 print(count)