import sys

input = lambda: sys.stdin.readline().rstrip()



N = int(eval(input()))



c = eval(input())



a = c.count('R')



b = 0

ans = max(a, b)



for i in range(len(c)):

    if c[i] == 'R':

        a -= 1

    else:

        b += 1

    now = max(a, b)    

    ans = min(ans, now)



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

A = eval(input())



r_cnt = A.count('R')



ans = 0

for i in range(r_cnt):

    if A[i] != 'R':

        ans += 1



print(ans)
import sys

input = lambda: sys.stdin.readline().rstrip()
N = int(eval(input()))
c = eval(input())
a = c.count("R")
b = 0
ans = max(a, b)
for i in range(len(c)):
    if c[i] == "R":
        a -= 1
    else:
        b += 1
    now = max(a, b)
    ans = min(ans, now)
print(ans)

N = int(eval(input()))
A = eval(input())
r_cnt = A.count("R")
ans = 0
for i in range(r_cnt):
    if A[i] != "R":
        ans += 1
print(ans)

-import sys - -input = lambda: sys.stdin.readline().rstrip() -c = eval(input()) -a = c.count("R") -b = 0 -ans = max(a, b) -for i in range(len(c)): -    if c[i] == "R": -        a -= 1 -    else: -        b += 1 -    now = max(a, b) -    ans = min(ans, now) +A = eval(input()) +r_cnt = A.count("R") +ans = 0 +for i in range(r_cnt): +    if A[i] != "R": +        ans += 1