n = int(input())
li_c = input()
r_index = [i for i,x in enumerate(li_c) if x=="R"]
w_index = [i for i,x in enumerate(li_c) if x=="W"]
r_num = len(r_index)
w_num = len(w_index)

R = r_num
W = 0
ans = max(R, W)
for i in range(n):
    if li_c[i]=="R":
        R -= 1
    else:
        W += 1
    ans = min(ans, max(R, W))
print(ans) n = int(input()) n int(input()) int input() input li_c = input() li_c input() input i for i,x in enumerate(li_c) if x=="R" for i,x in enumerate(li_c) if x=="R" i x enumerate(li_c) enumerate li_c x=="R" x "R" if x=="R" i r_index = [i for i,x in enumerate(li_c) if x=="R"] r_index [i for i,x in enumerate(li_c) if x=="R"] i for i,x in enumerate(li_c) if x=="W" for i,x in enumerate(li_c) if x=="W" i x enumerate(li_c) enumerate li_c x=="W" x "W" if x=="W" i w_index = [i for i,x in enumerate(li_c) if x=="W"] w_index [i for i,x in enumerate(li_c) if x=="W"] r_num = len(r_index) r_num len(r_index) len r_index w_num = len(w_index) w_num len(w_index) len w_index R = r_num R r_num W = 0 W 0 ans = max(R, W) ans max(R, W) max R W for i in range(n):
    if li_c[i]=="R":
        R -= 1
    else:
        W += 1
    ans = min(ans, max(R, W)) i range(n) range n if li_c[i]=="R":
        R -= 1
    else:
        W += 1
     li_c[i]=="R" li_c[i] li_c i "R" R -= 1 R 1 W += 1 W 1 ans = min(ans, max(R, W)) ans min(ans, max(R, W)) min ans max(R, W) max R W print(ans) print ans w_index = [i for i,x in enumerate(li_c) if x=="W"] [i for i,x in enumerate(li_c) if x=="W"] w_index W = 0 0 W R -= 1 1 R n = int(input()) int(input()) n W += 1 1 W ans = max(R, W) max(R, W) ans ans = min(ans, max(R, W)) min(ans, max(R, W)) ans r_index = [i for i,x in enumerate(li_c) if x=="R"] [i for i,x in enumerate(li_c) if x=="R"] r_index w_num = len(w_index) len(w_index) w_num r_num = len(r_index) len(r_index) r_num li_c = input() input() li_c R = r_num r_num R
n = int(input())
li_c = input()
r_index = [i for i,x in enumerate(li_c) if x=="R"]
w_index = [i for i,x in enumerate(li_c) if x=="W"]
r_num = len(r_index)
w_num = len(w_index)

R = r_num
W = 0
ans = max(R, W)
for i in range(n):
    if li_c[i]=="R":
        R -= 1
    else:
        W += 1
    ans = min(ans, max(R, W))
print(ans)