function Main(s){
  input = s.trim();
  var ss = input.split("\n");
  var num = ss[0];
  var results = []; 
 
  for(var i = 1; i < num; i++){
    var left = [];
    var arr = ss[1].split('');
    for(var j = 0; j < i; j++){
      var a = arr.shift();
      left.push(a);
    }
    left.pop();
    var left_filter = left.filter( function (value) {
      return value == 'W';
    });
    var right_filter = arr.filter( function (value) {
      return value == 'E';
    });
    var result = left_filter.length + right_filter.length;
    results.push(result);
    //console.log(left_filter);
    //console.log(right_filter);
    //console.log(left);
    //console.log(result);
    //console.log("---");
  }
  console.log(Math.min.apply(null, results));
  
}

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