program sample
    implicit none
    character(200000)::s
    integer(8) :: i,j,m,n,a,b,c,d
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n
    allocate(x(n))
    read(*,*)s
    c=1
    d=n
    m=0
    do 
    do i=c,n
        if(s(i:i) .eq. 'W')then
            a=i
            exit
        elseif(i==n)then
            a=n+1
            exit
        end if
    end do
    do i=d,1,-1
        if(s(i:i) .eq. 'R')then
            b=i
            exit
        elseif(i==1)then
            b=0
            exit
        end if
    end do
    if(a<b)then
        m=m+1
        c=a+1
        d=b-1
    else
        exit
    end if
    end do
    
    write(*,*) m
  
    stop
end program sample
  

