      PROGRAM AlterAltar
      IMPLICIT NONE
      INTEGER,PARAMETER :: p = 8
      integer(p) :: n, l,r, ans
      character(:),allocatable ::c 
      
      
      read*,n
      allocate( character(n) :: c )
      read*,c
      
      
      ans = 0
      l = 1
      r = n
      outer:&
      do while(.true.)
        do while( .true. )
          if( c(r:r)=='R' )then
            exit
          elseif( l>=r )then
            exit outer
          else
            r = r - 1
          end if
        end do
        
        do while( .true. )
          if( c(l:l)=='W' )then
            ans = ans + 1
            r = r - 1
            l = l + 1
            exit
          elseif( l>=r )then
            exit outer
          else
            l = l + 1
          end if
        end do
      !  print*,l,r
      end do outer
      
      
      print*,ans
      
      
      stop
      !debugg
      print*,'debugg'
      print*,n
      print*,c

      END PROGRAM