import Data.List

main = do
  n <- read <$> getLine
  s <- getLine
  putStrLn $ show $ minimum [count (take (i-1) s, drop i s) | i <- [0..n]]
  
count :: (String, String) -> Int
count (west, east) = (length $ elemIndices 'W' west) + (length $ elemIndices 'E' east)
