import math
n = int(input())
ar = input()
w = 0
r = 0
ans = 0
for i in ar:
  if i == 'W':
    w += 1
  else:
    r += 1
if w == 0 or r == 0:
  print(ans)
else:
  for j in range(-1,-len(ar)-1,-1):
    if w == 0:
      break
    if ar[j] == 'R':
      ans += 1
    w -= 1
  print(ans) import math math n = int(input()) n int(input()) int input() input ar = input() ar input() input w = 0 w 0 r = 0 r 0 ans = 0 ans 0 for i in ar:
  if i == 'W':
    w += 1
  else:
    r += 1 i ar if i == 'W':
    w += 1
  else:
    r += 1 i == 'W' i 'W' w += 1 w 1 r += 1 r 1 if w == 0 or r == 0:
  print(ans)
else:
  for j in range(-1,-len(ar)-1,-1):
    if w == 0:
      break
    if ar[j] == 'R':
      ans += 1
    w -= 1
  print(ans) w == 0 or r == 0 w == 0 w 0 r == 0 r 0 print(ans) print ans for j in range(-1,-len(ar)-1,-1):
    if w == 0:
      break
    if ar[j] == 'R':
      ans += 1
    w -= 1
   j range(-1,-len(ar)-1,-1) range -1 -len(ar)-1 -len(ar) len(ar) len ar 1 -1 if w == 0:
      break
     w == 0 w 0 break if ar[j] == 'R':
      ans += 1
     ar[j] == 'R' ar[j] ar j 'R' ans += 1 ans 1 w -= 1 w 1 print(ans) print ans n = int(input()) int(input()) n ar = input() input() ar r = 0 0 r w = 0 0 w r += 1 1 r w -= 1 1 w ans = 0 0 ans ans += 1 1 ans w += 1 1 w
import math
n = int(input())
ar = input()
w = 0
r = 0
ans = 0
for i in ar:
  if i == 'W':
    w += 1
  else:
    r += 1
if w == 0 or r == 0:
  print(ans)
else:
  for j in range(-1,-len(ar)-1,-1):
    if w == 0:
      break
    if ar[j] == 'R':
      ans += 1
    w -= 1
  print(ans)