N = input().split() M = int(N[0]) a = [input() for i in range(M)] match = 0 for j in range(M): match += a[j].count("W") print(match)