output_description: Print an integer representing the minimum number of operations needed.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      c_{1}c_{2}...c_{N}
attempt: from collections import deque
  
  N = int(input())
  state = input()
  
  newlist = sorted(state)
  goalstate = "".join(newlist)
  # print("goal is " + goalstate)
  
  # action1 is flippingg R(W)
  # action2 is changing position of two ones
  # and goal is no left W to all R
  # Distinguish if W is left of R
  uni = 0
  for l in range(len(goalstate)):
      if goalstate[l] == "W":
          uni = l
          break
  
  
  def bfs(state, goalstate):
      cur_state = deque([state])
      cou = 0
      while cou < 4:
          cur = cur_state.popleft()
          if cur == goalstate:
              return cou
              break
          new = list(cur)
          temp = 0
          for i in range(len(goalstate)):
              if new[i] == "W":
                  temp = i
                  break
          neow = 0
          for j in range(uni - 1, len(goalstate)):
              if new[j] == "R":
                  neow = j
                  break
          tempstr = new.pop(temp)
          temp1str = new.pop(neow - 1)
          new.insert(neow, tempstr)
          new.insert(temp, temp1str)
          nowstr = "".join(new)
          cur_state.append(nowstr)
          cou += 1
  
  
  goal = bfs(state, goalstate)
  print(goal)
  
problem_description: Statement
  
  An altar enshrines N stones arranged in a row from left to right. The color of
  the i-th stone from the left (1 \leq i \leq N) is given to you as a character
  c_i; `R` stands for red and `W` stands for white.
  
  You can do the following two kinds of operations any number of times in any
  order:
  
    * Choose two stones (not necessarily adjacent) and swap them.
    * Choose one stone and change its color (from red to white and vice versa).
  
  According to a fortune-teller, a white stone placed to the immediate left of a
  red stone will bring a disaster. At least how many operations are needed to
  reach a situation without such a white stone?
samples: [{"input": "4\n    WWRR", "output": "2\n    \n\nFor example, the two operations below will achieve the objective.\n\n  * Swap the 1-st and 3-rd stones from the left, resulting in `RWWR`.\n  * Change the color of the 4-th stone from the left, resulting in `RWWW`.\n\n* * *"}, {"input": "2\n    RR", "output": "0\n    \n\nIt can be the case that no operation is needed.\n\n* * *"}, {"input": "8\n    WRWWRWRR", "output": "3"}]