"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const C = arg[1].split("");
    
    let Rcnt = 0;
    let Wcnt = 0;
    
    let Rplace = [];
    let done = [];
    
    for(let i=0; i<N; i++) {
        if(C[i] === "R") {
            Rplace.push(i);
        }
    }
    
    let answer = 0;
    
     for(let i=0; i<N; i++) {
        if(C[i] === "R" && done.indexOf(i) !== -1) {
            continue;
        } else if(C[i] === "W") {
            Wcnt++;
        }
        
        if(Wcnt > 0 && C[i] === "R") {
            for(let j=0; j<Wcnt; j++) {
                let temp = Rplace.pop();
                
                if(temp === i) {
                    answer++;
                    break;
                }
                
                done.push(temp);
                
                answer++;
            }
        }
     }

    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));