const fs = require("fs");

function Main(input){
    input = input.split("\n");
    var N = input[0];
    var direction = input[1].split("");
    var ans=[];
    for(i = 0; i <= N-1; i++){
        var p = i;
        var countE = 0;
        var countW = 0;
        for(j = 0; j < p; j++){
            if(direction[j] == "W"){
                countW++;
            }
        } 
        for(k = p+1; k <= N-1; k++){
            if(direction[k] == "E"){
                countE++;
            }
        }
        ans[i] = countE + countW;
    }
    console.log(Math.min.apply(null, ans));
}

Main(fs.readFileSync("/dev/stdin", "utf8"))