n, _ = map(int, input().split()) cnt = 0 for i in range(n): w = input() cnt += w.count('W') print(cnt)