n=int(eval(input()))

A=list(eval(input()))



w=A.count("W")

r=A.count("R")



W=0 ; R=r

ans=R

for i in range(n):

    if A[i]=="W": W+=1

    else: R-=1

    ans=min(ans, max(W,R))



print(ans)

    
n=int(eval(input()))

A=list(eval(input()))

w=0 ; r=A.count("R") ; ans=10**7

for i in range(n+1):

    ans=min(ans, max(w,r))

    if i==n:print(ans);exit()

    if A[i]=="R":

        r-=1

    else:

        w+=1

n = int(eval(input()))
A = list(eval(input()))
w = A.count("W")
r = A.count("R")
W = 0
R = r
ans = R
for i in range(n):
    if A[i] == "W":
        W += 1
    else:
        R -= 1
    ans = min(ans, max(W, R))
print(ans)

n = int(eval(input()))
A = list(eval(input()))
w = 0
r = A.count("R")
ans = 10**7
for i in range(n + 1):
    ans = min(ans, max(w, r))
    if i == n:
        print(ans)
        exit()
    if A[i] == "R":
        r -= 1
    else:
        w += 1

-w = A.count("W") +w = 0 -W = 0 -R = r -ans = R -for i in range(n): -    if A[i] == "W": -        W += 1 +ans = 10**7 +for i in range(n + 1): +    ans = min(ans, max(w, r)) +    if i == n: +        print(ans) +        exit() +    if A[i] == "R": +        r -= 1 -        R -= 1 -    ans = min(ans, max(W, R)) -print(ans) +        w += 1