def solve():
    N = int(input())
    S = input()
    C = [c for c in S]

    left = 0
    right = len(C) -1
    ans = 0
    while left < right:
        while left < right and C[left] == 'R':
            left += 1
        while left < right and C[right] == 'W':
            right -= 1
        if left < right:
            C[left] = 'R'
            C[right] = 'W'
            ans += 1
            left += 1
            right -= 1
    print(ans)

if __name__ == "__main__":
    solve() def solve():
    N = int(input())
    S = input()
    C = [c for c in S]

    left = 0
    right = len(C) -1
    ans = 0
    while left < right:
        while left < right and C[left] == 'R':
            left += 1
        while left < right and C[right] == 'W':
            right -= 1
        if left < right:
            C[left] = 'R'
            C[right] = 'W'
            ans += 1
            left += 1
            right -= 1
    print(ans) solve N = int(input()) N int(input()) int input() input S = input() S input() input c for c in S for c in S c S for c in S c C = [c for c in S] C [c for c in S] left = 0 left 0 right = len(C) -1 right len(C) -1 len(C) len C 1 ans = 0 ans 0 while left < right:
        while left < right and C[left] == 'R':
            left += 1
        while left < right and C[right] == 'W':
            right -= 1
        if left < right:
            C[left] = 'R'
            C[right] = 'W'
            ans += 1
            left += 1
            right -= 1
     left < right left right while left < right and C[left] == 'R':
            left += 1
         left < right and C[left] == 'R' left < right left right C[left] == 'R' C[left] C left 'R' left += 1 left 1 while left < right and C[right] == 'W':
            right -= 1
         left < right and C[right] == 'W' left < right left right C[right] == 'W' C[right] C right 'W' right -= 1 right 1 if left < right:
            C[left] = 'R'
            C[right] = 'W'
            ans += 1
            left += 1
            right -= 1
     left < right left right C[left] = 'R' C[left] C left 'R' C[right] = 'W' C[right] C right 'W' ans += 1 ans 1 left += 1 left 1 right -= 1 right 1 print(ans) print ans if __name__ == "__main__":
    solve() __name__ == "__main__" __name__ "__main__" solve() solve def solve():
    N = int(input())
    S = input()
    C = [c for c in S]

    left = 0
    right = len(C) -1
    ans = 0
    while left < right:
        while left < right and C[left] == 'R':
            left += 1
        while left < right and C[right] == 'W':
            right -= 1
        if left < right:
            C[left] = 'R'
            C[right] = 'W'
            ans += 1
            left += 1
            right -= 1
    print(ans) def solve():
    N = int(input())
    S = input()
    C = [c for c in S]

    left = 0
    right = len(C) -1
    ans = 0
    while left < right:
        while left < right and C[left] == 'R':
            left += 1
        while left < right and C[right] == 'W':
            right -= 1
        if left < right:
            C[left] = 'R'
            C[right] = 'W'
            ans += 1
            left += 1
            right -= 1
    print(ans) solve
def solve():
    N = int(input())
    S = input()
    C = [c for c in S]

    left = 0
    right = len(C) -1
    ans = 0
    while left < right:
        while left < right and C[left] == 'R':
            left += 1
        while left < right and C[right] == 'W':
            right -= 1
        if left < right:
            C[left] = 'R'
            C[right] = 'W'
            ans += 1
            left += 1
            right -= 1
    print(ans)

if __name__ == "__main__":
    solve()