n = gets.to_i
c = gets.chomp
i = 0
j = n - 1
count = 0
while true do
  while i < n && c[i] == "R" do
    i += 1
  end
  while j >= 0 && c[j] == "W" do
    j -= 1
  end
  if i < j
    count += 1
    i += 1
    j -= 1
  else
    break
  end
end
puts count
