n = gets.to_i
c = gets.chomp.chars
p = [c.count('W'), c.count('R')]
v = []
v[0] = (c[0] == 'W' ? 1 : 0)
n.pred.times do |i|
  v[i + 1] = v[i] + (c[i + 1] == 'W' ? 1 : 0)
end
ans = p.min
cnt = 0
mm = 0
md = p[0]
-1.downto(-n) do |i|
  if c[i] == 'R'
    mm += 1
    md = p[0] + i
    ans = mm + md if ans > mm + md
  else
    md = p[0] + i
    ans = mm + md if ans > mm + md
  end
  break if p[0] == -i
end
puts ans