n = gets.chomp.to_i
c = gets.chomp.split("")
arr = []
aka = []
siro = []
count_aka = 0
count_siro = 0 
c.each_with_index do |item,j|
    if item == "R"
        aka << j
        count_aka += 1
    elsif item == "W"
        siro << j
        count_siro += 1
    end
end
count = 0
aka.each do |k|
    if count_aka - 1 >= k
        count += 1
    end
end
sa = count_aka - count #動かす数

arr =  [sa,count_aka,count_siro].min
puts [arr,0].max