N = int(input())
c = list(input())
Rn = c.count("R") # 区切りの右側に存在するRの数
Wn = 0 # 区切りの左側に存在するWの数
ans = N
for i in range(N+1):
    if i == 0:
        ans = Rn
    else:
        if c[i-1] == "R":
            Rn -= 1
        else:
            Wn += 1
        ans = min(ans, min(Rn, Wn) + abs(Rn - Wn))
print(ans) N = int(input()) N int(input()) int input() input c = list(input()) c list(input()) list input() input Rn = c.count("R") Rn c.count("R") c.count c count "R" Wn = 0 Wn 0 ans = N ans N for i in range(N+1):
    if i == 0:
        ans = Rn
    else:
        if c[i-1] == "R":
            Rn -= 1
        else:
            Wn += 1
        ans = min(ans, min(Rn, Wn) + abs(Rn - Wn)) i range(N+1) range N+1 N 1 if i == 0:
        ans = Rn
    else:
        if c[i-1] == "R":
            Rn -= 1
        else:
            Wn += 1
        ans = min(ans, min(Rn, Wn) + abs(Rn - Wn)) i == 0 i 0 ans = Rn ans Rn if c[i-1] == "R":
            Rn -= 1
        else:
            Wn += 1
         c[i-1] == "R" c[i-1] c i-1 i 1 "R" Rn -= 1 Rn 1 Wn += 1 Wn 1 ans = min(ans, min(Rn, Wn) + abs(Rn - Wn)) ans min(ans, min(Rn, Wn) + abs(Rn - Wn)) min ans min(Rn, Wn) + abs(Rn - Wn) min(Rn, Wn) min Rn Wn abs(Rn - Wn) abs Rn - Wn Rn Wn print(ans) print ans ans = N N ans Wn += 1 1 Wn N = int(input()) int(input()) N c = list(input()) list(input()) c Rn = c.count("R") c.count("R") Rn ans = min(ans, min(Rn, Wn) + abs(Rn - Wn)) min(ans, min(Rn, Wn) + abs(Rn - Wn)) ans Rn -= 1 1 Rn Wn = 0 0 Wn ans = Rn Rn ans
N = int(input())
c = list(input())
Rn = c.count("R") # 区切りの右側に存在するRの数
Wn = 0 # 区切りの左側に存在するWの数
ans = N
for i in range(N+1):
    if i == 0:
        ans = Rn
    else:
        if c[i-1] == "R":
            Rn -= 1
        else:
            Wn += 1
        ans = min(ans, min(Rn, Wn) + abs(Rn - Wn))
print(ans)