n = gets.to_i
c = gets.chomp
i = 0
j = n - 1
res = 0
while i < j
  if c[i] == "W" && c[i + 1] == "R"
    while i < j && c[j] != "R"
      j -= 1
    end
    if i < j
      c[i], c[j] = c[j], c[i]
      res += 1
    end
  end
  i += 1
end

c.gsub!(/W*$/, '')
puts res + c.scan('W').length
