n = gets.to_i
c = gets.chomp

count = 0

i = 0
j = n - 1

loop do
  i = c.index('W', i)
  break if i.nil?
  j = c.rindex('R', j)
  break if j.nil?
  break if j < i

  c[i], c[j] = [c[j], c[i]]
  count += 1
  i += 1
  j -= 1
end

puts count
