open Printf
open Scanf

let id x = x

let n = scanf "%d\n" id
let str = scanf "%s\n" id

let rec loop left right n =
    printf "DEBUG: %d %d %d\n" left right n;
    if left >= right then n
    else if str.[left] = 'R' then loop (left + 1) right n
    else if str.[right] = 'W' then loop left (right - 1) n
    else loop (left + 1) (right - 1) (n + 1)

let () =
    printf "%d\n" (loop 0 (String.length str - 1) 0)
