defmodule Main do
  def alter_altar(_n, seq) do
    res = %{W: Regex.scan(~r/W/, seq)|> Enum.count, R: Regex.scan(~r/R/, seq)|> Enum.count}
    suffix_seq = Regex.scan(~r/W+R+\Z/, seq)
    res1 = cond do
                    Enum.count(suffix_seq) > 0 ->
                      Enum.flat_map(suffix_seq, fn list -> Enum.map(list,
                        fn e -> %{W: Regex.scan(~r/W/, e)|> Enum.count, R: Regex.scan(~r/R/, e)|> Enum.count}
                        end)
                      end)
                      |> Enum.at(0)
                    true ->
                      Regex.scan(~r/R+W+\Z/, seq)
                      |>  Enum.flat_map(fn list -> Enum.map(list,
                            fn e -> %{W: Regex.scan(~r/W/, e)|> Enum.count, R: Regex.scan(~r/R/, e)|> Enum.count}
                            end)
                          end)
                      |> Enum.at(0)
            end
    cond do
      Map.get(res,:W) <= Map.get(res1,:R) -> Map.get(res,:W) - Map.get(res1,:W) + min(Map.get(res1,:R) - (Map.get(res,:W) -Map.get(res1,:W)),Map.get(res,:W))
      true -> Map.get(res1,:R) + max(Map.get(res,:W) - Map.get(res1,:W) - Map.get(res1,:R),0)
    end
  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
