import java.util.Scanner; public class No_712 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int Y = sc.nextInt(); int count = 0; for(int i = 0 ; i < N ; i++) { String[] s = sc.next().split(""); for(String ss :s) { if("W".equals(ss)) count++; } } System.out.println(count); } }