function main(input) {
  const n = parseInt(input[0]);
  let c = input[1].split("");

  let cnt = 0;

  let edge_s = 0;
  let edge_e = n-1;

  while(edge_s<edge_e){
    let judge = true;
    while(c[edge_s]==="R"){
      if(edge_s>=edge_e){
        judge = false;
        break;
      }
      edge_s++;
    }
    while(c[edge_e]==="W"){
      if(edge_s>=edge_e){
        judge = false;
        break;
      }
      edge_e--;
    }
    if(judge){
      c[edge_s]="R";
      c[edge_e]="W";
      cnt++;
    }else{
      break;
    }
  }
  console.log(cnt);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));