n = int(input().rstrip())
red = []
white = []
stones = input().rstrip()
for idx, stone in enumerate(stones):
  if stone == "R":
    red.append(idx)
  if stone == "W":
    white.append(idx)
red_len = len(red)
white_len = len(white)
cnt = 0
for i in range(min(red_len, white_len)):
  red_idx = red[-1-i]
  white_idx = white[i]
  if red_idx> white_idx:
    cnt += 1
  else:
    break
print(cnt) n = int(input().rstrip()) n int(input().rstrip()) int input().rstrip() ().rstrip () input rstrip red = [] red [] white = [] white [] stones = input().rstrip() stones input().rstrip() ().rstrip () input rstrip for idx, stone in enumerate(stones):
  if stone == "R":
    red.append(idx)
  if stone == "W":
    white.append(idx) idx stone enumerate(stones) enumerate stones if stone == "R":
    red.append(idx)
   stone == "R" stone "R" red.append(idx) red.append red append idx if stone == "W":
    white.append(idx) stone == "W" stone "W" white.append(idx) white.append white append idx red_len = len(red) red_len len(red) len red white_len = len(white) white_len len(white) len white cnt = 0 cnt 0 for i in range(min(red_len, white_len)):
  red_idx = red[-1-i]
  white_idx = white[i]
  if red_idx> white_idx:
    cnt += 1
  else:
    break i range(min(red_len, white_len)) range min(red_len, white_len) min red_len white_len red_idx = red[-1-i] red_idx red[-1-i] red -1-i -1 i white_idx = white[i] white_idx white[i] white i if red_idx> white_idx:
    cnt += 1
  else:
    break red_idx> white_idx red_idx white_idx cnt += 1 cnt 1 break print(cnt) print cnt n = int(input().rstrip()) int(input().rstrip()) n stones = input().rstrip() input().rstrip() stones cnt = 0 0 cnt red_len = len(red) len(red) red_len red = [] [] red white = [] [] white cnt += 1 1 cnt red_idx = red[-1-i] red[-1-i] red_idx white_len = len(white) len(white) white_len white_idx = white[i] white[i] white_idx
n = int(input().rstrip())
red = []
white = []
stones = input().rstrip()
for idx, stone in enumerate(stones):
  if stone == "R":
    red.append(idx)
  if stone == "W":
    white.append(idx)
red_len = len(red)
white_len = len(white)
cnt = 0
for i in range(min(red_len, white_len)):
  red_idx = red[-1-i]
  white_idx = white[i]
  if red_idx> white_idx:
    cnt += 1
  else:
    break
print(cnt)