import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val m = sc.nextInt()
    val n = sc.next()

    val east = n.toCharArray.reverse
      .scanLeft(0)(
        (acc, c) =>
          c match {
            case 'E' => acc + 1
            case 'W' => acc
        }
      )
      .reverse
    debug(east.mkString(" "))

    val west = n.toCharArray
      .scanLeft(0)(
        (acc, c) =>
          c match {
            case 'E' => acc
            case 'W' => acc + 1
        }
      )

    debug(west.mkString(" "))

    val ans =
      for (i <- 0 until m) yield {
        east(i + 1) + west(i)
      }

    println(ans.min)
  }

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}
