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


w_min = w_list.min
r_max = r_list.max

if w_min > r_max
  puts 0
  exit
end

cnt = 0
while(w_min < r_max)
  cnt += 1
  w_target = w_list.min
  r_target = r_list.max
  w_list.delete(w_target)
  r_list.delete(r_target)
  w_list.push(r_target)
  r_list.push(w_target)

  w_min = w_list.min
  r_max = r_list.max
end

puts cnt
