n=int(eval(input()))

c=eval(input())

if "R" not in c or "W" not in c:print((0));exit()

rcnt=[0]*(n+1)

wcnt=[0]*(n+1)

for i in range(n):

    if c[i]=="W":

        wcnt[i+1]=wcnt[i]+1

        rcnt[i+1]=rcnt[i]

    else:

        rcnt[i+1]=rcnt[i]+1

        wcnt[i+1]=wcnt[i]

ans=n+100

for i in range(n):

    cw=wcnt[i+1]

    cr=rcnt[-1]-rcnt[i+1]

    ans=min(ans,cw+cr-min(cr,cw))

ans=min(ans,wcnt[-1])

print(ans)
n=int(eval(input()))

s=eval(input())

r=s.count('R')

print((s[:r].count('W')))
n = int(eval(input()))
c = eval(input())
if "R" not in c or "W" not in c:
    print((0))
    exit()
rcnt = [0] * (n + 1)
wcnt = [0] * (n + 1)
for i in range(n):
    if c[i] == "W":
        wcnt[i + 1] = wcnt[i] + 1
        rcnt[i + 1] = rcnt[i]
    else:
        rcnt[i + 1] = rcnt[i] + 1
        wcnt[i + 1] = wcnt[i]
ans = n + 100
for i in range(n):
    cw = wcnt[i + 1]
    cr = rcnt[-1] - rcnt[i + 1]
    ans = min(ans, cw + cr - min(cr, cw))
ans = min(ans, wcnt[-1])
print(ans)

n = int(eval(input()))
s = eval(input())
r = s.count("R")
print((s[:r].count("W")))

-c = eval(input()) -if "R" not in c or "W" not in c: -    print((0)) -    exit() -rcnt = [0] * (n + 1) -wcnt = [0] * (n + 1) -for i in range(n): -    if c[i] == "W": -        wcnt[i + 1] = wcnt[i] + 1 -        rcnt[i + 1] = rcnt[i] -    else: -        rcnt[i + 1] = rcnt[i] + 1 -        wcnt[i + 1] = wcnt[i] -ans = n + 100 -for i in range(n): -    cw = wcnt[i + 1] -    cr = rcnt[-1] - rcnt[i + 1] -    ans = min(ans, cw + cr - min(cr, cw)) -ans = min(ans, wcnt[-1]) -print(ans) +s = eval(input()) +r = s.count("R") +print((s[:r].count("W")))