n = $stdin.gets.chomp.to_i
arr = gets.chomp.split('')

ans = 0
mae_w = 0;usi_r = 0
while true
  p arr
  mae_w = arr.index('W')
  usi_r = arr.rindex('R')
  if usi_r.nil? || mae_w.nil?
    puts ans
    exit
  end
  if mae_w-1 == usi_r 
    puts ans
    exit
  end
  arr[mae_w] = 'R';arr[usi_r] = "W"
  ans += 1
end
  