import numpy as np #処理 def count(N,M): num=0 for i in range(N): for j in range(M): if A[i][j] == 'W': num += 1 return num #入力(手入力) matrix = input().split() A = [] row = int(matrix[0]) column = int(matrix[1]) for i in range(int(matrix[0])): A.append(input()) #出力 print('塗る回数',count(row,column))