n = gets.to_i
stones = gets.chomp

left = stones.index(/W/)
right = stones.index(/R(?!.*R)/)

white = 0
red = 0

while left != nil && right != nil && left < right
    white += 1 if stones[left] == "W"
    red   += 1 if stones[right] == "R"
    if (white == red && stones.index("R",left)>right)
        break
    end
    left = left + 1
    right = right - 1
end

puts white


#while (stones=~/WR/)
#    stones.sub!(/R(?!.*R)/,"W").sub!(/W/,"R")
#    count += 1
#end
#puts count
