import           GHC.Int
import qualified Data.ByteString.Lazy.Char8    as BC
import qualified Data.Vector.Unboxed as V

main = do
    n  <- readLn :: IO Int
    as <- V.fromList <$> getLine
    print $ minimum [ g $ V.splitAt k as | k <- [0 .. n - 1] ]

g t = (V.length . V.filter (=='W') $ fst t) + (V.length . V.filter (=='E') $ snd t)
