n = gets.to_i
c = gets.chomp.chars
pL = 0
pR = n-1
ans = 0
loop do
  while c[pL]=="R"
    pL += 1
  end
  while c[pR]=="W"
    pR -= 1
  end
  if pL >= pR
    p ans
    exit
  end
  ans += 1
  pL += 1
  pR -= 1
end
