n = int(eval(input()))

C = list(eval(input()))

l, r, c = 0, n-1, 0

while l < r:

    if C[l] == 'W' and C[r] == 'R':

        l += 1

        r -= 1

        c += 1

    elif C[l] != 'W': l += 1

    elif C[r] != 'R': r -= 1

print(c)

n = int(eval(input()))

C = list(eval(input()))

r = C.count('R')

c = 0

for i in range(r, n):

    if C[i] == 'R': c += 1

print(c)

n = int(eval(input()))
C = list(eval(input()))
l, r, c = 0, n - 1, 0
while l < r:
    if C[l] == "W" and C[r] == "R":
        l += 1
        r -= 1
        c += 1
    elif C[l] != "W":
        l += 1
    elif C[r] != "R":
        r -= 1
print(c)

n = int(eval(input()))
C = list(eval(input()))
r = C.count("R")
c = 0
for i in range(r, n):
    if C[i] == "R":
        c += 1
print(c)

-l, r, c = 0, n - 1, 0 -while l < r: -    if C[l] == "W" and C[r] == "R": -        l += 1 -        r -= 1 +r = C.count("R") +c = 0 +for i in range(r, n): +    if C[i] == "R": -    elif C[l] != "W": -        l += 1 -    elif C[r] != "R": -        r -= 1