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