input = readlines()

n = input.shift.chomp.to_i
list = input.shift.chomp.split('').map{|x| x.to_s}

w_list = []
w_min = nil
r_list = []
r_max = nil

list.each_with_index do |l, i|
  w_list.push(i) if l == 'W'
  r_list.push(i) if l == 'R'
end

if w_list.length == 0 || r_list.length == 0
  puts 0
  exit
end

cnt = 0
(0..list.length - 1).each do |ci|
  w_target = w_list[ci]
  r_target = r_list[r_list.length - 1 - ci]
  if w_target.nil? || r_target.nil?
    puts cnt
    exit #####
  end
  if w_target > r_target
    puts cnt
    break
  end
  cnt += 1
end
