object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val areE = sc.next.map(_ == 'E')

    println {
      (0 until n).map(leader =>
        (0 until leader).count(! areE(_)) +
          ((leader + 1) until n).count(areE)
      ).min
    }
  }
}
