def result(n)
  # $stderr.puts C.to_s
  puts n
  exit
end

N = $stdin.gets.to_i
C = $stdin.gets.strip.split(//)
rp = 0
wp = C.length - 1
cnt = 0
loop do
  while C[rp] == 'R'
    if (rp += 1) == wp
      result cnt
    end
  end
  while C[wp] == 'W'
    if (wp -= 1) == rp
      result cnt
    end
  end
  C[rp] = 'R'
  C[wp] = 'W'
  cnt += 1
  # $stderr.puts "#{rp} #{wp}"
end
