N = gets.chomp.to_i
colors = gets.chomp.chars.map { |c| c == "R" ? 1 : 0 }

w = 0
r = colors.size - 1
ans = 0
while w < r
  w += 1 while w < r && !colors[w].zero?
  r -= 1 while w < r && colors[r].zero?
  break if w == r
  colors[w] = 1
  colors[r] = 0
  ans += 1
end

puts ans
