n = int(input())
c = input()

t = n
lw, rr = 0, c.count('R')
for ci in c+'Z':
    swap = min(lw, rr)
    wtor, rtow = max(0, lw-swap), max(0, rr-swap)
    t = min(t, swap + wtor + rtow)
    lw = lw + (ci == 'W')
    rr = rr - (ci == 'R')

print(t) n = int(input()) n int(input()) int input() input c = input() c input() input t = n t n lw, rr = 0, c.count('R') lw 0 rr c.count('R') c.count c count 'R' for ci in c+'Z':
    swap = min(lw, rr)
    wtor, rtow = max(0, lw-swap), max(0, rr-swap)
    t = min(t, swap + wtor + rtow)
    lw = lw + (ci == 'W')
    rr = rr - (ci == 'R') ci c+'Z' c 'Z' swap = min(lw, rr) swap min(lw, rr) min lw rr wtor, rtow = max(0, lw-swap), max(0, rr-swap) wtor max(0, lw-swap) max 0 lw-swap lw swap rtow max(0, rr-swap) max 0 rr-swap rr swap t = min(t, swap + wtor + rtow) t min(t, swap + wtor + rtow) min t swap + wtor + rtow swap + wtor swap wtor rtow lw = lw + (ci == 'W') lw lw + (ci == 'W') lw ci == 'W' ci 'W' rr = rr - (ci == 'R') rr rr - (ci == 'R') rr ci == 'R' ci 'R' print(t) print t swap = min(lw, rr) min(lw, rr) swap rr = rr - (ci == 'R') rr - (ci == 'R') rr lw, rr = 0, c.count('R') 0 lw t = min(t, swap + wtor + rtow) min(t, swap + wtor + rtow) t lw = lw + (ci == 'W') lw + (ci == 'W') lw rtow = max(0, lw-swap), max(0, rr-swap) max(0, rr-swap) rtow c = input() input() c wtor, rtow = max(0, lw-swap), max(0, rr-swap) max(0, lw-swap) wtor t = n n t n = int(input()) int(input()) n rr = 0, c.count('R') c.count('R') rr
n = int(input())
c = input()

t = n
lw, rr = 0, c.count('R')
for ci in c+'Z':
    swap = min(lw, rr)
    wtor, rtow = max(0, lw-swap), max(0, rr-swap)
    t = min(t, swap + wtor + rtow)
    lw = lw + (ci == 'W')
    rr = rr - (ci == 'R')

print(t)
