program alter_altar
    character(200001) :: c
    integer i, x, y
    integer :: k = 0
    integer :: n = 0

    read *, n
    read *, c

    do i = 1, n
        x = index(c,'W')
        y = index(c,'R',back=.true.)
        if(x == 0 .or. y == 0)exit
        if(x < y)then
            c(x:x) = 'R'
            c(y:y) = 'W'
            k  = k + 1
        end if
    end do
    print *, k
end program