from collections import Counter

N = int(input())
C = list(input())

cnt = Counter(C)
ans1 = min(cnt["R"], cnt["W"])

ans2 = 0
l, r = 0, N-1
while l < r:
    if C[l] == "W" and C[r] == "R":
        ans2 += 1
        l += 1
        r -= 1
    else:
        if C[l] == "R":
            l += 1
        if C[r] == "W":
            r -= 1

ans = min(ans1, ans2)
print(ans)

 from collections import Counter N = int(input()) N int(input()) int input() input C = list(input()) C list(input()) list input() input cnt = Counter(C) cnt Counter(C) Counter C ans1 = min(cnt["R"], cnt["W"]) ans1 min(cnt["R"], cnt["W"]) min cnt["R"] cnt "R" cnt["W"] cnt "W" ans2 = 0 ans2 0 l, r = 0, N-1 l 0 r N-1 N 1 while l < r:
    if C[l] == "W" and C[r] == "R":
        ans2 += 1
        l += 1
        r -= 1
    else:
        if C[l] == "R":
            l += 1
        if C[r] == "W":
            r -= 1 l < r l r if C[l] == "W" and C[r] == "R":
        ans2 += 1
        l += 1
        r -= 1
    else:
        if C[l] == "R":
            l += 1
        if C[r] == "W":
            r -= 1 C[l] == "W" and C[r] == "R" C[l] == "W" C[l] C l "W" C[r] == "R" C[r] C r "R" ans2 += 1 ans2 1 l += 1 l 1 r -= 1 r 1 if C[l] == "R":
            l += 1
         C[l] == "R" C[l] C l "R" l += 1 l 1 if C[r] == "W":
            r -= 1 C[r] == "W" C[r] C r "W" r -= 1 r 1 ans = min(ans1, ans2) ans min(ans1, ans2) min ans1 ans2 print(ans) print ans l, r = 0, N-1 0 l ans1 = min(cnt["R"], cnt["W"]) min(cnt["R"], cnt["W"]) ans1 N = int(input()) int(input()) N r = 0, N-1 N-1 r ans = min(ans1, ans2) min(ans1, ans2) ans l += 1 1 l r -= 1 1 r l += 1 1 l cnt = Counter(C) Counter(C) cnt ans2 = 0 0 ans2 ans2 += 1 1 ans2 C = list(input()) list(input()) C r -= 1 1 r
from collections import Counter

N = int(input())
C = list(input())

cnt = Counter(C)
ans1 = min(cnt["R"], cnt["W"])

ans2 = 0
l, r = 0, N-1
while l < r:
    if C[l] == "W" and C[r] == "R":
        ans2 += 1
        l += 1
        r -= 1
    else:
        if C[l] == "R":
            l += 1
        if C[r] == "W":
            r -= 1

ans = min(ans1, ans2)
print(ans)


