#yuki712 n,m=map(int,raw_input().split()) res=0 for i in xrange(n): a=raw_input() res+=a.count('W') print res