program alter_altar
  implicit none
  integer :: n, m = 0, l = 1, r
  character(200000) :: s
  read(*,*) n
  read(*,*) s
  r = n
  do
    do while (l <= n .and. s(l:l) == 'R')
      l = l + 1
    end do
    do while (r >= 1 .and. s(r:r) == 'W')
      r = r - 1
    end do
    if (l >= r) exit
    m = m + 1
    s(l:l) = 'R'
    s(r:r) = 'W'
  end do
  write(*,'(i0)') m
end program alter_altar