n = gets.to_i
s = gets.chomp

stack = s.chars
         .each_with_index
         .filter_map{|ch, i| i if ch == "R"}
ans = s.chars
       .each_with_index
       .filter_map{|ch, i| i if ch == "W"}
       .take_while{|i| !stack.empty? && i < stack.pop}
       .size
p ans