N = input() M = N.split() P = [int(I) for I in M] a = 0 for i in range(P[0]): n = input() a = a + n.count('W') else: print(a)