process.stdin.resume();
process.stdin.setEncoding('utf8');
// Your code here!

function main(arg) {
    //let bit = arg.split("").map(x=>x=="W"?0:1)
    let bit = arg.split("\n")[1].split("").map(x=>x=="W"?0:1)
//console.log(bit)
    let zeros = []
    for(let i=0; i<bit.length; i++) {
        if(bit[i]===0)
            zeros.push(i)
    }
    
    let ans=0
    let p=0
    for(let i=bit.length-1; i>=0; i--) {
        //console.log(i)
        if(bit[i]===1 && bit[zeros[p]]===0 && i>p){
            //console.log("----")
            bit[zeros[p]]=1
            p++
            bit[i]=0
            ans++
        }
    }
    console.log(ans)
    
    
}

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