a,b = map(int,input().split()) c = 0 for i in range(a): d = list(input()) c += d.count("w") print(c)