n = int(input())
c = list(input())
r = 0
w = 0
for i in range(len(c)):
    if(c[i]=="R"):
        r += 1
ans = max(r,w)
for i in range(len(c)):
    if(c[i]=="R"):
        r -= 1
    else:
        w += 1
    now = max(r,w)
    ans = min(ans,now)
print(ans)     n = int(input()) n int(input()) int input() input c = list(input()) c list(input()) list input() input r = 0 r 0 w = 0 w 0 for i in range(len(c)):
    if(c[i]=="R"):
        r += 1 i range(len(c)) range len(c) len c if(c[i]=="R"):
        r += 1 c[i]=="R" c[i] c i "R" r += 1 r 1 ans = max(r,w) ans max(r,w) max r w for i in range(len(c)):
    if(c[i]=="R"):
        r -= 1
    else:
        w += 1
    now = max(r,w)
    ans = min(ans,now) i range(len(c)) range len(c) len c if(c[i]=="R"):
        r -= 1
    else:
        w += 1
     c[i]=="R" c[i] c i "R" r -= 1 r 1 w += 1 w 1 now = max(r,w) now max(r,w) max r w ans = min(ans,now) ans min(ans,now) min ans now print(ans) print ans ans = min(ans,now) min(ans,now) ans w += 1 1 w r -= 1 1 r w = 0 0 w now = max(r,w) max(r,w) now r = 0 0 r r += 1 1 r c = list(input()) list(input()) c ans = max(r,w) max(r,w) ans n = int(input()) int(input()) n
n = int(input())
c = list(input())
r = 0
w = 0
for i in range(len(c)):
    if(c[i]=="R"):
        r += 1
ans = max(r,w)
for i in range(len(c)):
    if(c[i]=="R"):
        r -= 1
    else:
        w += 1
    now = max(r,w)
    ans = min(ans,now)
print(ans)    