# D - Alter Altar
N = int(input())
c = input()
white_l = 0
red_r = 0
for i in range(N):
    if c[i]=='R':
        red_r += 1
ans = red_r
for i in range(N):
    if c[i]=='W':
        white_l += 1
    else:
        red_r -= 1
    ans = min(ans, max(red_r,white_l))
print(ans) N = int(input()) N int(input()) int input() input c = input() c input() input white_l = 0 white_l 0 red_r = 0 red_r 0 for i in range(N):
    if c[i]=='R':
        red_r += 1 i range(N) range N if c[i]=='R':
        red_r += 1 c[i]=='R' c[i] c i 'R' red_r += 1 red_r 1 ans = red_r ans red_r for i in range(N):
    if c[i]=='W':
        white_l += 1
    else:
        red_r -= 1
    ans = min(ans, max(red_r,white_l)) i range(N) range N if c[i]=='W':
        white_l += 1
    else:
        red_r -= 1
     c[i]=='W' c[i] c i 'W' white_l += 1 white_l 1 red_r -= 1 red_r 1 ans = min(ans, max(red_r,white_l)) ans min(ans, max(red_r,white_l)) min ans max(red_r,white_l) max red_r white_l print(ans) print ans white_l = 0 0 white_l ans = min(ans, max(red_r,white_l)) min(ans, max(red_r,white_l)) ans c = input() input() c N = int(input()) int(input()) N white_l += 1 1 white_l red_r -= 1 1 red_r red_r = 0 0 red_r ans = red_r red_r ans red_r += 1 1 red_r
# D - Alter Altar
N = int(input())
c = input()
white_l = 0
red_r = 0
for i in range(N):
    if c[i]=='R':
        red_r += 1
ans = red_r
for i in range(N):
    if c[i]=='W':
        white_l += 1
    else:
        red_r -= 1
    ans = min(ans, max(red_r,white_l))
print(ans)