n = gets.to_i
s = gets.chomp

stack = []
(0...n).each do |i|
  stack << i if s[i] == "R"
end

ans = 0
(0...n).each do |i|
  if s[i] == "W"
    j = stack.pop
    break if j.nil? || i > j
    ans += 1
  end
end

puts ans