N = gets.chomp.to_i

word = gets.chomp

count = 0

def get_leftmost_w_and_rightmost_r(word)
  left = nil
  right = nil
  0.upto(word.length-1) do |i|
    left ||= i if word.chars[i] == 'W'
    right ||= word.length-i-1 if word.chars[word.length-i-1] == 'R'

    return [left, right] if !left.nil? && !right.nil?
  end

  [left, right]
end

leftmost_w, rightmost_r = get_leftmost_w_and_rightmost_r(word)

while !leftmost_w.nil? && !rightmost_r.nil? && leftmost_w < rightmost_r
  word[leftmost_w] = 'R'
  word[rightmost_r] = 'W'
  count += 1
  leftmost_w, rightmost_r = get_leftmost_w_and_rightmost_r(word)
end

puts count