N = int(input())
C = input()
a = 0
rr = 0
lw = 0

for i in range(N):
    if C[i] == 'R':
        rr += 1
a = rr
for i in range(0, N):
    if C[i] == 'W':
        lw = lw+1
    else:
        rr = rr-1
    a = min(a, max(lw, rr))

print(a) N = int(input()) N int(input()) int input() input C = input() C input() input a = 0 a 0 rr = 0 rr 0 lw = 0 lw 0 for i in range(N):
    if C[i] == 'R':
        rr += 1 i range(N) range N if C[i] == 'R':
        rr += 1 C[i] == 'R' C[i] C i 'R' rr += 1 rr 1 a = rr a rr for i in range(0, N):
    if C[i] == 'W':
        lw = lw+1
    else:
        rr = rr-1
    a = min(a, max(lw, rr)) i range(0, N) range 0 N if C[i] == 'W':
        lw = lw+1
    else:
        rr = rr-1
     C[i] == 'W' C[i] C i 'W' lw = lw+1 lw lw+1 lw 1 rr = rr-1 rr rr-1 rr 1 a = min(a, max(lw, rr)) a min(a, max(lw, rr)) min a max(lw, rr) max lw rr print(a) print a lw = lw+1 lw+1 lw rr = rr-1 rr-1 rr N = int(input()) int(input()) N lw = 0 0 lw C = input() input() C a = 0 0 a rr += 1 1 rr a = min(a, max(lw, rr)) min(a, max(lw, rr)) a a = rr rr a rr = 0 0 rr
N = int(input())
C = input()
a = 0
rr = 0
lw = 0

for i in range(N):
    if C[i] == 'R':
        rr += 1
a = rr
for i in range(0, N):
    if C[i] == 'W':
        lw = lw+1
    else:
        rr = rr-1
    a = min(a, max(lw, rr))

print(a)
