N=gets.to_i
C=gets.chars
wht=*red=Array.new(N+1){0}
N.times do |i|
  wht[i+1]+=wht[i]
  wht[i+1]+=1 if C[i]==?W
  j=N-i
  red[j-1]+=red[j]
  red[j-1]+=1 if C[j-1]==?R
end
p wht.zip(red).map{|w,r|w+r-[w,r].min}.min