n = gets.to_i
c = gets.chomp
ans = 0
l = 0
r = n - 1
while l < r
  while l < n && c[l] == 'R' do
    l += 1
  end
  while r >= 0 && c[r] == 'W' do
    r -= 1
  end
  if l < n && r >= 0 && l < r
    c[l], c[r] = c[r], c[l]
    ans += 1
  end
end
puts ans
