N=int(input())
c=str(input())
num_R = c.count("R")
num_W = 0
ans = []
if num_R >= num_W:
    ans.append(num_R)
else:
    ans.append(num_W)
#print(ans)
for i in range(len(c)):
    if c[i] == "R":
        num_R -= 1
    else:
        num_W += 1
    if num_R >= num_W:
        ans.append(num_R)
    else:
        ans.append(num_W)
    #print(ans)
print(min(ans)) N=int(input()) N int(input()) int input() input c=str(input()) c str(input()) str input() input num_R = c.count("R") num_R c.count("R") c.count c count "R" num_W = 0 num_W 0 ans = [] ans [] if num_R >= num_W:
    ans.append(num_R)
else:
    ans.append(num_W)
#print(ans) num_R >= num_W num_R num_W ans.append(num_R) ans.append ans append num_R ans.append(num_W) ans.append ans append num_W for i in range(len(c)):
    if c[i] == "R":
        num_R -= 1
    else:
        num_W += 1
    if num_R >= num_W:
        ans.append(num_R)
    else:
        ans.append(num_W)
    #print(ans) i range(len(c)) range len(c) len c if c[i] == "R":
        num_R -= 1
    else:
        num_W += 1
     c[i] == "R" c[i] c i "R" num_R -= 1 num_R 1 num_W += 1 num_W 1 if num_R >= num_W:
        ans.append(num_R)
    else:
        ans.append(num_W)
    #print(ans) num_R >= num_W num_R num_W ans.append(num_R) ans.append ans append num_R ans.append(num_W) ans.append ans append num_W print(min(ans)) print min(ans) min ans c=str(input()) str(input()) c ans = [] [] ans num_W += 1 1 num_W num_R -= 1 1 num_R N=int(input()) int(input()) N num_W = 0 0 num_W num_R = c.count("R") c.count("R") num_R
N=int(input())
c=str(input())
num_R = c.count("R")
num_W = 0
ans = []
if num_R >= num_W:
    ans.append(num_R)
else:
    ans.append(num_W)
#print(ans)
for i in range(len(c)):
    if c[i] == "R":
        num_R -= 1
    else:
        num_W += 1
    if num_R >= num_W:
        ans.append(num_R)
    else:
        ans.append(num_W)
    #print(ans)
print(min(ans))
