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

lw, rr = [0]*(n+1), [c.count('R')]*(n+1)
for i in range(n):
    lw[i+1] = lw[i] + (c[i] == 'W')
    rr[i+1] = rr[i] - (c[i] == 'R')


def operation(left_white, right_red):
    swap = min(left_white, right_red)
    white_to_red, red_to_white = max(0, left_white-swap), max(0, right_red-swap)
    return swap + white_to_red + red_to_white


print(min(operation(white, red) for white, red in zip(lw, rr))) n = int(input()) n int(input()) int input() input c = input() c input() input lw, rr = [0]*(n+1), [c.count('R')]*(n+1) lw [0]*(n+1) [0] 0 n+1 n 1 rr [c.count('R')]*(n+1) [c.count('R')] c.count('R') c.count c count 'R' n+1 n 1 for i in range(n):
    lw[i+1] = lw[i] + (c[i] == 'W')
    rr[i+1] = rr[i] - (c[i] == 'R') i range(n) range n lw[i+1] = lw[i] + (c[i] == 'W') lw[i+1] lw i+1 i 1 lw[i] + (c[i] == 'W') lw[i] lw i c[i] == 'W' c[i] c i 'W' rr[i+1] = rr[i] - (c[i] == 'R') rr[i+1] rr i+1 i 1 rr[i] - (c[i] == 'R') rr[i] rr i c[i] == 'R' c[i] c i 'R' def operation(left_white, right_red):
    swap = min(left_white, right_red)
    white_to_red, red_to_white = max(0, left_white-swap), max(0, right_red-swap)
    return swap + white_to_red + red_to_white operation swap = min(left_white, right_red) swap min(left_white, right_red) min left_white right_red white_to_red, red_to_white = max(0, left_white-swap), max(0, right_red-swap) white_to_red max(0, left_white-swap) max 0 left_white-swap left_white swap red_to_white max(0, right_red-swap) max 0 right_red-swap right_red swap return swap + white_to_red + red_to_white swap + white_to_red + red_to_white swap + white_to_red swap white_to_red red_to_white left_white left_white right_red right_red print(min(operation(white, red) for white, red in zip(lw, rr))) print min(operation(white, red) for white, red in zip(lw, rr)) min operation(white, red) operation white red lw, rr = [0]*(n+1), [c.count('R')]*(n+1) [0]*(n+1) lw def operation(left_white, right_red):
    swap = min(left_white, right_red)
    white_to_red, red_to_white = max(0, left_white-swap), max(0, right_red-swap)
    return swap + white_to_red + red_to_white def operation(left_white, right_red):
    swap = min(left_white, right_red)
    white_to_red, red_to_white = max(0, left_white-swap), max(0, right_red-swap)
    return swap + white_to_red + red_to_white operation rr = [0]*(n+1), [c.count('R')]*(n+1) [c.count('R')]*(n+1) rr c = input() input() c n = int(input()) int(input()) n
n = int(input())
c = input()

lw, rr = [0]*(n+1), [c.count('R')]*(n+1)
for i in range(n):
    lw[i+1] = lw[i] + (c[i] == 'W')
    rr[i+1] = rr[i] - (c[i] == 'R')


def operation(left_white, right_red):
    swap = min(left_white, right_red)
    white_to_red, red_to_white = max(0, left_white-swap), max(0, right_red-swap)
    return swap + white_to_red + red_to_white


print(min(operation(white, red) for white, red in zip(lw, rr)))
