END { load __FILE__ unless $stdin.eof? }

n = gets.to_i
stones = gets.chomp.chars.map! { |c| c == 'W' }

cnt = 0
loop do
  ptr_w = stones.index { |s| s } || n
  ptr_r = stones.rindex { |s| !s } || -1
  break if ptr_w >= ptr_r
  cnt += 1
  stones = stones[(ptr_w + 1)...ptr_r]
  n = stones.size
end

puts cnt
