object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN) = readLine.split(" ").map(_.toInt)
    val datA = readLine.split("").filterNot(_ == "")

    val ans = (0 until datA.length).map{ lead =>
      datA.take(lead).filter(_ == "W").length +
      datA.drop(lead + 1).filter(_ == "E").length
    }.min

    println(ans)
  }
}
