N = int(input())
c = list(list(input()))

#仕切りの右側の赤石の数rr
#仕切りの左側の赤石の数rl
rr, rl = c.count("R"), 0

#全ての石の色が同じ場合
if rr == 0 or rr == N:
  print(0)
  exit()

#仕切りの右側の白石の数wr
#仕切りの左側の白石の数wl
wr, wl = N - rr, 0

for i in range(N + 1):
  if i == 0:
    ans = min(rr, wr)
    continue

  if c[i-1] == "R":
    rr -= 1
    rl += 1
  else:
    wr -= 1
    wl += 1

  if rr >= wl:
    ans = min(ans, rr)
  else: ans = min(ans, wl)

print(ans) N = int(input()) N int(input()) int input() input c = list(list(input())) c list(list(input())) list list(input()) list input() input rr, rl = c.count("R"), 0 rr c.count("R") c.count c count "R" rl 0 if rr == 0 or rr == N:
  print(0)
  exit()

#仕切りの右側の白石の数wr
#仕切りの左側の白石の数wl rr == 0 or rr == N rr == 0 rr 0 rr == N rr N print(0) print 0 exit() exit wr, wl = N - rr, 0 wr N - rr N rr wl 0 for i in range(N + 1):
  if i == 0:
    ans = min(rr, wr)
    continue

  if c[i-1] == "R":
    rr -= 1
    rl += 1
  else:
    wr -= 1
    wl += 1

  if rr >= wl:
    ans = min(ans, rr)
  else: ans = min(ans, wl) i range(N + 1) range N + 1 N 1 if i == 0:
    ans = min(rr, wr)
    continue

   i == 0 i 0 ans = min(rr, wr) ans min(rr, wr) min rr wr continue if c[i-1] == "R":
    rr -= 1
    rl += 1
  else:
    wr -= 1
    wl += 1

   c[i-1] == "R" c[i-1] c i-1 i 1 "R" rr -= 1 rr 1 rl += 1 rl 1 wr -= 1 wr 1 wl += 1 wl 1 if rr >= wl:
    ans = min(ans, rr)
  else: ans = min(ans, wl) rr >= wl rr wl ans = min(ans, rr) ans min(ans, rr) min ans rr print(ans) print ans wl = N - rr, 0 0 wl rr -= 1 1 rr ans = min(ans, rr) min(ans, rr) ans wr, wl = N - rr, 0 N - rr wr rl = c.count("R"), 0 0 rl wr -= 1 1 wr N = int(input()) int(input()) N c = list(list(input())) list(list(input())) c ans = min(rr, wr) min(rr, wr) ans wl += 1 1 wl rr, rl = c.count("R"), 0 c.count("R") rr rl += 1 1 rl
N = int(input())
c = list(list(input()))

#仕切りの右側の赤石の数rr
#仕切りの左側の赤石の数rl
rr, rl = c.count("R"), 0

#全ての石の色が同じ場合
if rr == 0 or rr == N:
  print(0)
  exit()

#仕切りの右側の白石の数wr
#仕切りの左側の白石の数wl
wr, wl = N - rr, 0

for i in range(N + 1):
  if i == 0:
    ans = min(rr, wr)
    continue

  if c[i-1] == "R":
    rr -= 1
    rl += 1
  else:
    wr -= 1
    wl += 1

  if rr >= wl:
    ans = min(ans, rr)
  else: ans = min(ans, wl)

print(ans)