main = do
  _      <- getLine
  colors <- getLine
  let noRs = length $ filter (== 'R') colors
  let noWs = length $ filter (== 'W') colors
  let scanFunction ((rL, wL), (rR, wR)) 'R' = ((rL + 1, wL), (rR - 1, wR))
      scanFunction ((rL, wL), (rR, wR)) 'W' = ((rL, wL + 1), (rR, wR - 1))
  let ops ((rL, wL), (rR, wR)) = max wL rR
  print $ minimum $ map ops $ scanl scanFunction ((0, 0), (noRs, noWs)) colors
