N = gets.to_i
c = gets.chomp.chars

# 全部どちらか or R..RW..Wb でOK

zenbu = [c.count(?R), c.count(?W)].min

rw = 0
left = 0
right = N-1
while true
    # pp c
    while c[left] == ?R
        left += 1
    end
    while c[right] == ?W
        right -= 1
    end
    break if left >= right

    c[left] = ?R
    c[right] = ?W
    rw += 1
end

p [zenbu, rw].min