n = gets.to_i
s = gets.chomp
a = s.chars

l = nil
r = nil

nr = 0
for i in 0...n
    if a[i] == 'R'
        nr += 1
        r = i
    else
        l = i unless l
    end
end

l = nr unless l

ans = 0
for i in 0...n
    r = n-1-i

    break if l >= r || l >= nr

    if a[r] == 'R'
        # swap l <-> r
        # p "swap l:#{l} r:#{r}"
        a[r] = 'W'
        a[l] = 'R'
        l += 1
        ans += 1
        while a[l] == 'R' && l < r
            l += 1
        end
    end
end

nl = n - nr

ans = nl if ans > nl
ans = nr if ans > nr

puts ans