require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
s = gets.chomp

if s.chars.all?{|c| c == 'R'} || s.chars.all?{|c| c == 'W'}
  puts 0
  exit
end

l = 0
r = n-1

ans = 0
while l < r
  while s[l] == 'R'
    l += 1
  end
  while s[r] == 'W'
    r -= 1
  end

  break unless l < r

  ans += 1
  l += 1
  r -= 1
end

puts ans
