N = int(input())
C = input()
num_w = 0
num_r = 0
for i in range(N):
    if C[i] == 'R':
        num_r += 1
ans = 10**10
for i in range(N+1):
    if i == 0:
        ans = min(ans, num_r)
    elif i == N:
        ans = min(ans, num_w)
    else:
        if C[i-1] == 'W':
            num_w += 1
        else:
            num_r -=1 
        ans = min(ans, max(num_r, num_w))
print(ans) N = int(input()) N int(input()) int input() input C = input() C input() input num_w = 0 num_w 0 num_r = 0 num_r 0 for i in range(N):
    if C[i] == 'R':
        num_r += 1 i range(N) range N if C[i] == 'R':
        num_r += 1 C[i] == 'R' C[i] C i 'R' num_r += 1 num_r 1 ans = 10**10 ans 10**10 10 10 for i in range(N+1):
    if i == 0:
        ans = min(ans, num_r)
    elif i == N:
        ans = min(ans, num_w)
    else:
        if C[i-1] == 'W':
            num_w += 1
        else:
            num_r -=1 
        ans = min(ans, max(num_r, num_w)) i range(N+1) range N+1 N 1 if i == 0:
        ans = min(ans, num_r)
    elif i == N:
        ans = min(ans, num_w)
    else:
        if C[i-1] == 'W':
            num_w += 1
        else:
            num_r -=1 
        ans = min(ans, max(num_r, num_w)) i == 0 i 0 ans = min(ans, num_r) ans min(ans, num_r) min ans num_r elif i == N:
        ans = min(ans, num_w)
     i == N i N ans = min(ans, num_w) ans min(ans, num_w) min ans num_w if C[i-1] == 'W':
            num_w += 1
        else:
            num_r -=1 
         C[i-1] == 'W' C[i-1] C i-1 i 1 'W' num_w += 1 num_w 1 num_r -=1 num_r 1 ans = min(ans, max(num_r, num_w)) ans min(ans, max(num_r, num_w)) min ans max(num_r, num_w) max num_r num_w print(ans) print ans ans = 10**10 10**10 ans num_w += 1 1 num_w num_r = 0 0 num_r ans = min(ans, num_w) min(ans, num_w) ans ans = min(ans, num_r) min(ans, num_r) ans ans = min(ans, max(num_r, num_w)) min(ans, max(num_r, num_w)) ans N = int(input()) int(input()) N num_r += 1 1 num_r num_r -=1 1 num_r C = input() input() C num_w = 0 0 num_w
N = int(input())
C = input()
num_w = 0
num_r = 0
for i in range(N):
    if C[i] == 'R':
        num_r += 1
ans = 10**10
for i in range(N+1):
    if i == 0:
        ans = min(ans, num_r)
    elif i == N:
        ans = min(ans, num_w)
    else:
        if C[i-1] == 'W':
            num_w += 1
        else:
            num_r -=1 
        ans = min(ans, max(num_r, num_w))
print(ans)