N = int(input())
c = list(input())
a=0; b=0; ans = 0

for i in range(N):
    if c[i] == "R":
        a += 1
ans = max(a,b)

for i in range(N):
    if c[i] == "R":
        a -= 1
    else:
        b += 1
    now = max(a,b)
    ans = min(ans,now)
print(ans) N = int(input()) N int(input()) int input() input c = list(input()) c list(input()) list input() input a=0 a 0 b=0 b 0 ans = 0 ans 0 for i in range(N):
    if c[i] == "R":
        a += 1 i range(N) range N if c[i] == "R":
        a += 1 c[i] == "R" c[i] c i "R" a += 1 a 1 ans = max(a,b) ans max(a,b) max a b for i in range(N):
    if c[i] == "R":
        a -= 1
    else:
        b += 1
    now = max(a,b)
    ans = min(ans,now) i range(N) range N if c[i] == "R":
        a -= 1
    else:
        b += 1
     c[i] == "R" c[i] c i "R" a -= 1 a 1 b += 1 b 1 now = max(a,b) now max(a,b) max a b ans = min(ans,now) ans min(ans,now) min ans now print(ans) print ans ans = max(a,b) max(a,b) ans c = list(input()) list(input()) c a -= 1 1 a b += 1 1 b a=0 0 a now = max(a,b) max(a,b) now N = int(input()) int(input()) N ans = min(ans,now) min(ans,now) ans ans = 0 0 ans a += 1 1 a b=0 0 b
N = int(input())
c = list(input())
a=0; b=0; ans = 0

for i in range(N):
    if c[i] == "R":
        a += 1
ans = max(a,b)

for i in range(N):
    if c[i] == "R":
        a -= 1
    else:
        b += 1
    now = max(a,b)
    ans = min(ans,now)
print(ans)