function main(arg) {
    let n = Number(arg.split("\n")[0])
    let bit = arg.split("\n")[1].split("").map(x=>x=="W"?0:1)
    
    let w=0,r=0
    for(let i=0; i<n; i++) {
        if(bit[i]===0)w++
        else r++
    }
    w=0
    let min=n
    for(let i=0; i<=n; i++) {
        min = Math.min(min,Math.max(w,r))
//        console.log(`w=${w}, r=${r}, min=${min}`)
            if(bit[i]===0) {
                w++
            } else {
                r--
            }
    }
    console.log(min)
    
}


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