# coding: utf-8

# Your code here!





N=int(eval(input()))

List=eval(input())

AList=list(List)

#print(AList)

#print(sorted(List))

RCNT=AList.count("R")

BList=sorted(List)

#print(List[0])



#print(RCNT)



ANUM=0

BNUM=0

ans=0

i=0

while i<N:

    if AList[i]=="R":

        ANUM+=1

    if BList[i]=="R":

        BNUM+=1

        

    #print(BNUM,ANUM)

    if AList[i]!=BList[i]:

        ans+=1

    if BNUM==RCNT or ANUM==RCNT:

        print(ans)

        quit()

    

    i+=1

    

print(ans)























N=int(eval(input()))

List=eval(input())

AList=list(List)

RCNT=AList.count("R")

BList=sorted(List)

ANUM=0

BNUM=0

ans=0

i=0

while i<N:

    if AList[i]!=BList[i]:

        ans+=1

    i+=1

print((ans//2))
# coding: utf-8
# Your code here!
N = int(eval(input()))
List = eval(input())
AList = list(List)
# print(AList)
# print(sorted(List))
RCNT = AList.count("R")
BList = sorted(List)
# print(List[0])
# print(RCNT)
ANUM = 0
BNUM = 0
ans = 0
i = 0
while i < N:
    if AList[i] == "R":
        ANUM += 1
    if BList[i] == "R":
        BNUM += 1
    # print(BNUM,ANUM)
    if AList[i] != BList[i]:
        ans += 1
    if BNUM == RCNT or ANUM == RCNT:
        print(ans)
        quit()
    i += 1
print(ans)

N = int(eval(input()))
List = eval(input())
AList = list(List)
RCNT = AList.count("R")
BList = sorted(List)
ANUM = 0
BNUM = 0
ans = 0
i = 0
while i < N:
    if AList[i] != BList[i]:
        ans += 1
    i += 1
print((ans // 2))

-# coding: utf-8 -# Your code here! -# print(AList) -# print(sorted(List)) -# print(List[0]) -# print(RCNT) -    if AList[i] == "R": -        ANUM += 1 -    if BList[i] == "R": -        BNUM += 1 -    # print(BNUM,ANUM) -    if BNUM == RCNT or ANUM == RCNT: -        print(ans) -        quit() -print(ans) +print((ans // 2))