n = int(eval(input()))

c = eval(input())



r = c.count("R")

w = n - r

cnt = 0

ans = 0

for i in c:

    if cnt == r:

        break

    if i == "W":

        ans += 1

    cnt += 1

print((min(r, w, ans)))
n = int(eval(input()))

c = eval(input())



r = c.count("R")

cnt = 0

for i, j in enumerate(c):

    if i == r:

        break

    if j == "W":

        cnt += 1

print(cnt)
n = int(eval(input()))
c = eval(input())
r = c.count("R")
w = n - r
cnt = 0
ans = 0
for i in c:
    if cnt == r:
        break
    if i == "W":
        ans += 1
    cnt += 1
print((min(r, w, ans)))

n = int(eval(input()))
c = eval(input())
r = c.count("R")
cnt = 0
for i, j in enumerate(c):
    if i == r:
        break
    if j == "W":
        cnt += 1
print(cnt)

-w = n - r -ans = 0 -for i in c: -    if cnt == r: +for i, j in enumerate(c): +    if i == r: -    if i == "W": -        ans += 1 -    cnt += 1 -print((min(r, w, ans))) +    if j == "W": +        cnt += 1 +print(cnt)