defmodule Main do
  def alter_altar(_n, seq) do
    res = Regex.scan(~r/W+R+/, seq)
        |> Enum.flat_map(fn list -> Enum.map(list,
                      fn e -> min(Regex.scan(~r/W/, e) |> Enum.count, Regex.scan(~r/R/, e)|> Enum.count)
                      end)
                    end)
        |> Enum.sum
  end

 def main do
    n = IO.gets("") |> String.trim() |> String.to_integer
    seq = IO.read(:line) |> String.trim()
    IO.puts alter_altar(n, seq)
 end
end