let () =
  let red = ref 0 in
  let rec charlist_of_string str n i =
    if i = n then []
    else if str.[i] = 'R' then (red := !red + 1; 'R' :: charlist_of_string str n (i+1))
    else 'W' :: charlist_of_string str n (i+1)  in
  let rec count lst target n i =
    if i = n then 0
    else match lst with
      | [] -> 0
      | h :: t -> if h = target then 1 + count t target n (i+1) else count t target n (i+1) in
  Scanf.scanf "%d\n%s\n" @@ fun n s ->
  let lst = charlist_of_string s (String.length s) 0 in
  Printf.printf "%d\n" (count lst 'W' (!red) 0)