def ascan; gets.split.map(&:to_i); end

H,W = ascan
p H.times.map{W - gets.chomp.chars.count('R')}.reduce(:+)