function main(input) {
    let lines = input.split("\n");
    let c = lines[1].split('');

    let cl = 0;
    let cr = c.length -1;
    let cnt = 0;
    while(true){
        cl = c.indexOf("W", cl);
        cr = c.lastIndexOf("R", cr);

        if(cl >= cr || cl === -1 || cr === -1){
            break;
        }

        let b = c[cl];
        c[cl] = c[cr];
        c[cr] = b;
        
        cnt++;
        cl++;
        cr--;
    }
    //console.log(c.join(""));

    return cnt;
}

//******************************
exports.main = main;

function Main(input) {
    console.log(main(input.trim()));
}

if (process.argv[2] !== "test") {
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}