n = gets.chomp.to_i
arr = gets.chomp.split('')
left, right = 0, arr.length - 1
count = 0
while true
  head_left = -1
  tail_right = -1
  left.upto(n - 1) do |i|
    if arr[i] == 'W'
      head_left = i
      break
    end
  end
  right.downto(0) do |i|
    if arr[i] == 'R'
      tail_right = i
      break
    end
  end
  break if head_left == -1 || tail_right == -1 || head_left >= tail_right
  arr[head_left], arr[tail_right] = arr[tail_right], arr[head_left]
  left = head_left
  right = tail_right
  count += 1
end
puts count
