n = int(eval(input()))

c = list(eval(input()))



left, right = 0, n - 1

cnt = 0

while True:

    while left < n and c[left] == 'R':

        left += 1

    while right >= 0 and c[right] == 'W':

        right -= 1

    if left >= right:

        break

    cnt += 1

    left, right = left + 1, right - 1

    

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

c = eval(input())

left, right = 0, n - 1

cnt = 0

while left <= right:

    while left < n and c[left] == 'R':

        left += 1

    while right > -1 and c[right] == 'W':

        right -= 1

    if left == n or right == -1 or left >= right: break

    left += 1

    right -= 1

    cnt += 1

print(cnt)
n = int(eval(input()))
c = list(eval(input()))
left, right = 0, n - 1
cnt = 0
while True:
    while left < n and c[left] == "R":
        left += 1
    while right >= 0 and c[right] == "W":
        right -= 1
    if left >= right:
        break
    cnt += 1
    left, right = left + 1, right - 1
print(cnt)

n = int(eval(input()))
c = eval(input())
left, right = 0, n - 1
cnt = 0
while left <= right:
    while left < n and c[left] == "R":
        left += 1
    while right > -1 and c[right] == "W":
        right -= 1
    if left == n or right == -1 or left >= right:
        break
    left += 1
    right -= 1
    cnt += 1
print(cnt)

-c = list(eval(input())) +c = eval(input()) -while True: +while left <= right: -    while right >= 0 and c[right] == "W": +    while right > -1 and c[right] == "W": -    if left >= right: +    if left == n or right == -1 or left >= right: +    left += 1 +    right -= 1 -    left, right = left + 1, right - 1