program ABC174D
    implicit none
    integer(8)::N,i,Wc(0:200000),Rc(0:200000),ans=2000000
    character(200000)::C
    read*,N,C
    Wc(0)=0
    Rc(0)=0
    do i=1,N
        if(C(i:i)=="R")then
            Rc(i)=Rc(i-1)+1
            Wc(i)=Wc(i-1)
        else
            Rc(i)=Rc(i-1)
            Wc(i)=Wc(i-1)+1
        end if
    end do

    do i=0,N
        ans=min(ans,max(Wc(i)-Wc(0),Rc(N)-Rc(i+1)))
    end do
    print'(i0)',ans
end program ABC174D