import sys
input = sys.stdin.readline

def main():
    N = int(input())
    c = input()
    cnt_r = 0
    cnt_w = 0
    for i in c:
        if i == 'R':
            cnt_r += 1
        else:
            cnt_w += 1
    
    w_left = 0
    r_right = cnt_r
    ans = N
    for i in range(N):
        ans = min(ans, max(w_left, r_right))

        if c[i] == 'W':
            w_left += 1
        else:
            r_right -= 1
    print(min(ans, max(w_left, r_right)))

main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def main():
    N = int(input())
    c = input()
    cnt_r = 0
    cnt_w = 0
    for i in c:
        if i == 'R':
            cnt_r += 1
        else:
            cnt_w += 1
    
    w_left = 0
    r_right = cnt_r
    ans = N
    for i in range(N):
        ans = min(ans, max(w_left, r_right))

        if c[i] == 'W':
            w_left += 1
        else:
            r_right -= 1
    print(min(ans, max(w_left, r_right))) main N = int(input()) N int(input()) int input() input c = input() c input() input cnt_r = 0 cnt_r 0 cnt_w = 0 cnt_w 0 for i in c:
        if i == 'R':
            cnt_r += 1
        else:
            cnt_w += 1
    
     i c if i == 'R':
            cnt_r += 1
        else:
            cnt_w += 1
    
     i == 'R' i 'R' cnt_r += 1 cnt_r 1 cnt_w += 1 cnt_w 1 w_left = 0 w_left 0 r_right = cnt_r r_right cnt_r ans = N ans N for i in range(N):
        ans = min(ans, max(w_left, r_right))

        if c[i] == 'W':
            w_left += 1
        else:
            r_right -= 1
     i range(N) range N ans = min(ans, max(w_left, r_right)) ans min(ans, max(w_left, r_right)) min ans max(w_left, r_right) max w_left r_right if c[i] == 'W':
            w_left += 1
        else:
            r_right -= 1
     c[i] == 'W' c[i] c i 'W' w_left += 1 w_left 1 r_right -= 1 r_right 1 print(min(ans, max(w_left, r_right))) print min(ans, max(w_left, r_right)) min ans max(w_left, r_right) max w_left r_right main() main input = sys.stdin.readline sys.stdin.readline input def main():
    N = int(input())
    c = input()
    cnt_r = 0
    cnt_w = 0
    for i in c:
        if i == 'R':
            cnt_r += 1
        else:
            cnt_w += 1
    
    w_left = 0
    r_right = cnt_r
    ans = N
    for i in range(N):
        ans = min(ans, max(w_left, r_right))

        if c[i] == 'W':
            w_left += 1
        else:
            r_right -= 1
    print(min(ans, max(w_left, r_right))) def main():
    N = int(input())
    c = input()
    cnt_r = 0
    cnt_w = 0
    for i in c:
        if i == 'R':
            cnt_r += 1
        else:
            cnt_w += 1
    
    w_left = 0
    r_right = cnt_r
    ans = N
    for i in range(N):
        ans = min(ans, max(w_left, r_right))

        if c[i] == 'W':
            w_left += 1
        else:
            r_right -= 1
    print(min(ans, max(w_left, r_right))) main
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    c = input()
    cnt_r = 0
    cnt_w = 0
    for i in c:
        if i == 'R':
            cnt_r += 1
        else:
            cnt_w += 1
    
    w_left = 0
    r_right = cnt_r
    ans = N
    for i in range(N):
        ans = min(ans, max(w_left, r_right))

        if c[i] == 'W':
            w_left += 1
        else:
            r_right -= 1
    print(min(ans, max(w_left, r_right)))

main()