let () = Scanf.scanf "%d\n" @@ fun n ->
  let cs = Array.init n @@ fun _ -> Scanf.scanf "%c" Fun.id in
  let reds = Array.make (n + 1) 0 in (* th以上の赤 *)
  let whites = Array.make (n + 1) 0 in (* th未満の白 *)
  for i = 0 to n - 1 do
    match cs.(i) with
    | 'R' -> reds.(i) <- reds.(i) + 1
    | 'W' -> whites.(i + 1) <- whites.(i + 1) + 1
  done;
  for i = n - 1 downto 0 do
    reds.(i) <- reds.(i) + reds.(i + 1)
  done;
  for i = 0 to n - 1 do
    whites.(i + 1) <- whites.(i) + whites.(i + 1)
  done;
  Printf.printf "%d\n" @@
  Array.fold_left min max_int @@
  Array.init (n + 1) @@ fun i -> max reds.(i) whites.(i)