n = gets.to_i
a = gets.chomp.split("")

front = 0
rear = n-1
finflag = false
count = 0

while(front<rear)
  while(a[front]=="R")
    front += 1
    if front == rear
      finflag = true
      break
    end
  end

  while(a[rear]=="W")
    rear -= 1
    if front == rear
      finflag = true
      break
    end
  end
  if finflag
    break
  end
  count += 1
  front += 1
  rear -= 1
  if front >= rear
    break
  end
end

puts("#{count}")