W_H_list = [ int(x) for x in input().split(" ")] flag_list = [] w_count = 0 for x in range(W_H_list[0]): flag_list.append(input()) w_count += flag_list[x].count("W") print(w_count)