N = gets.chomp.to_i
C = gets.chomp

c = C.each_char.to_a.map{ |_c| if _c == "R" then 0 else 1 end }.to_a.join

count = 0
left = 0
right = N - 1
while true
  if c[left] == "1"
    if c[right] == "0"
      left = left + 1
      right = right - 1
      count += 1
      break if left >= right
    else
      right = right - 1
      break if left >= right
    end
  else
    left = left + 1
    break if left >= right
  end
end

puts count
