import math, sys

N=int(input())
S=input()
R_count=0
if "R" not in S:
    print(0)
    sys.exit()
if "W" not in S:
    print(0)
    sys.exit()
if "R" not in S[S.index("W"):]:
    print(0)
    sys.exit()
for i in range(N):
    if S[i]=="R":
        R_count+=1

S=S[:R_count]
ans=S.count("W")
print(ans) import math, sys math sys N=int(input()) N int(input()) int input() input S=input() S input() input R_count=0 R_count 0 if "R" not in S:
    print(0)
    sys.exit() "R" not in S "R" S print(0) print 0 sys.exit() sys.exit sys exit if "W" not in S:
    print(0)
    sys.exit() "W" not in S "W" S print(0) print 0 sys.exit() sys.exit sys exit if "R" not in S[S.index("W"):]:
    print(0)
    sys.exit() "R" not in S[S.index("W"):] "R" S[S.index("W"):] S S.index("W"): S.index("W") S.index S index "W" print(0) print 0 sys.exit() sys.exit sys exit for i in range(N):
    if S[i]=="R":
        R_count+=1 i range(N) range N if S[i]=="R":
        R_count+=1 S[i]=="R" S[i] S i "R" R_count+=1 R_count 1 S=S[:R_count] S S[:R_count] S :R_count R_count ans=S.count("W") ans S.count("W") S.count S count "W" print(ans) print ans N=int(input()) int(input()) N ans=S.count("W") S.count("W") ans R_count+=1 1 R_count S=S[:R_count] S[:R_count] S R_count=0 0 R_count S=input() input() S
import math, sys

N=int(input())
S=input()
R_count=0
if "R" not in S:
    print(0)
    sys.exit()
if "W" not in S:
    print(0)
    sys.exit()
if "R" not in S[S.index("W"):]:
    print(0)
    sys.exit()
for i in range(N):
    if S[i]=="R":
        R_count+=1

S=S[:R_count]
ans=S.count("W")
print(ans)