n = gets.chomp.to_i
cs = gets.chomp

ridx = []
widx = []
cs.length.times do |idx|
  if cs[idx] == 'R'
    ridx.push(idx)
  else
    widx.push(idx)
  end
end

cnt = 0
while ridx.length > 0 and widx.length > 0
  r = ridx.pop
  w = widx.shift
  if r > w
    cnt += 1
  else
    break
  end
end

p cnt