n = int(eval(input()))

c = eval(input())



w = [0]*(n+1)

r = [0]*(n+1)

for i in range(0,n):

  w[i+1] = w[i]

  r[n-i-1] = r[n-i]

  if c[i]=='W':

    w[i+1] += 1

  if c[n-i-1]=='R':

    r[n-i-1] += 1



ans = 1e10

for i in range(0,n+1):

  ans = min(ans,w[i]+r[i]-min(w[i],r[i]))

print(ans)
n = int(eval(input()))

c = eval(input())



w = [0]*(n+1)

r = [0]*(n+1)

for i in range(0,n):

  w[i+1] = w[i]

  r[n-i-1] = r[n-i]

  if c[i]=='W':

    w[i+1] += 1

  if c[n-i-1]=='R':

    r[n-i-1] += 1



print((min([w[i]+r[i]-min(w[i],r[i]) for i in range(0,n+1)])))

n = int(eval(input()))
c = eval(input())
w = [0] * (n + 1)
r = [0] * (n + 1)
for i in range(0, n):
    w[i + 1] = w[i]
    r[n - i - 1] = r[n - i]
    if c[i] == "W":
        w[i + 1] += 1
    if c[n - i - 1] == "R":
        r[n - i - 1] += 1
ans = 1e10
for i in range(0, n + 1):
    ans = min(ans, w[i] + r[i] - min(w[i], r[i]))
print(ans)

n = int(eval(input()))
c = eval(input())
w = [0] * (n + 1)
r = [0] * (n + 1)
for i in range(0, n):
    w[i + 1] = w[i]
    r[n - i - 1] = r[n - i]
    if c[i] == "W":
        w[i + 1] += 1
    if c[n - i - 1] == "R":
        r[n - i - 1] += 1
print((min([w[i] + r[i] - min(w[i], r[i]) for i in range(0, n + 1)])))

-ans = 1e10 -for i in range(0, n + 1): -    ans = min(ans, w[i] + r[i] - min(w[i], r[i])) -print(ans) +print((min([w[i] + r[i] - min(w[i], r[i]) for i in range(0, n + 1)])))