require 'pp'

n = gets.to_i
chs = gets.chomp!.chars

head = 0
tail = chs.length - 1
count = 0
while head < tail
    # 左からwを探す
    while head < tail
        if chs[head] == "W"
            break
        end
        head += 1
        #pp head
    end

    while tail > head
        if chs[tail] == "R"
            break
        end
        tail -= 1

        #pp tail
    end

    #pp "======"
    #pp head
    #pp tail 

    break if head >= tail

    chs[head] = "R"
    chs[tail] = "W"
    #pp chs
    #head += 1
    #tail -= 1
    count += 1
end

puts count
