import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine().toInt
  val s = StdIn.readLine()

  
  val r = (0 until n).foldLeft(n){ (acc, index) =>
    scala.math.min(acc, 
      (0 until index).count(bi => 'W' == s(bi))
    + (index+1 until n).count(ai => 'E' == s(ai)))
  }
  println(r)
}
