main = do
  n <- read <$> getLine
  s <- getLine
  putStrLn $ show $ minimum [solve s i 0 0 | i <- [0..n]]
  
solve :: String -> Int -> Int -> Int -> Int
solve (x:xs) n i m
  | i < n  = if x == 'W' then solve xs n (i+1) (m+1) else solve xs n (i+1) m
  | i == n = solve xs n (i+1) m
  | i > n  = if x == 'E' then solve xs n (i+1) (m+1) else solve xs n (i+1) m
solve [] n i m = m    