let n = read_int ()
let c = read_line()

let rec r i s =
  if i = n then s
  else if c.[i] = 'R' then
    r (i + 1) (s + 1)
  else
    r (i + 1) s

let rec f i w r =
  if w == r then r
  else if c.[i] = 'W' then
    f (i + 1) (w + 1) r
  else
    f (i + 1) w (r - 1)

let () =
  let ans = f 0 0 (r 0 0) in
  Printf.printf "%d\n" ans
