N = gets.to_i
C = gets.chars.map{|s| s=="R"?0:1}

l=0
r=N-1

ans = 0
while l<r
    if C[l] == 0 then 
        l+=1 
        next 
    end
    if C[r] == 1 then 
        r-=1 
        next 
    end

    ans += 1
    l += 1
    r -= 1
end

p ans