n = gets.to_i
c = gets.chomp.split('')

last_idx = n - 1
count = 0

count = 0
0.upto(n).each do |i|
  next if c[i] != 'W'
  last_idx.downto(i+1).each do |j|
    next if c[j] != 'R'
    c[i], c[j] = [c[j], c[i]]
    count += 1
    last_idx = j
    break
  end
end

puts count
