main :: IO ()
main = do
  n <- (read :: String -> Int) <$> getLine
  xs <- getLine

  let wlen = length $ filter (=='W') xs
  print $ if wlen > (n `div` 2)
          then n `div` 2  - 1
          else wlen - 1