nM = list(map(int,input().split())) print(sum([input().count('W') for i in range(nM[0])]))