#!/usr/bin/env python3


def solve(N, S):
    l = 0
    r = len(S) - 1
    answer = 0
    while l < r:
        if S[l] == "R":
            l += 1
        elif S[r] == "W":
            r -= 1
        else:
            # S[l] == 'W' S[r] == 'R' l < r
            l += 1
            r -= 1
            answer += 1

    return answer


def main():
    N = int(input())
    S = input()
    answer = solve(N, S)
    print(answer)


if __name__ == "__main__":
    main() def solve(N, S):
    l = 0
    r = len(S) - 1
    answer = 0
    while l < r:
        if S[l] == "R":
            l += 1
        elif S[r] == "W":
            r -= 1
        else:
            # S[l] == 'W' S[r] == 'R' l < r
            l += 1
            r -= 1
            answer += 1

    return answer solve l = 0 l 0 r = len(S) - 1 r len(S) - 1 len(S) len S 1 answer = 0 answer 0 while l < r:
        if S[l] == "R":
            l += 1
        elif S[r] == "W":
            r -= 1
        else:
            # S[l] == 'W' S[r] == 'R' l < r
            l += 1
            r -= 1
            answer += 1

     l < r l r if S[l] == "R":
            l += 1
        elif S[r] == "W":
            r -= 1
        else:
            # S[l] == 'W' S[r] == 'R' l < r
            l += 1
            r -= 1
            answer += 1

     S[l] == "R" S[l] S l "R" l += 1 l 1 elif S[r] == "W":
            r -= 1
         S[r] == "W" S[r] S r "W" r -= 1 r 1 l += 1 l 1 r -= 1 r 1 answer += 1 answer 1 return answer answer N N S S def main():
    N = int(input())
    S = input()
    answer = solve(N, S)
    print(answer) main N = int(input()) N int(input()) int input() input S = input() S input() input answer = solve(N, S) answer solve(N, S) solve N S print(answer) print answer if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def solve(N, S):
    l = 0
    r = len(S) - 1
    answer = 0
    while l < r:
        if S[l] == "R":
            l += 1
        elif S[r] == "W":
            r -= 1
        else:
            # S[l] == 'W' S[r] == 'R' l < r
            l += 1
            r -= 1
            answer += 1

    return answer def solve(N, S):
    l = 0
    r = len(S) - 1
    answer = 0
    while l < r:
        if S[l] == "R":
            l += 1
        elif S[r] == "W":
            r -= 1
        else:
            # S[l] == 'W' S[r] == 'R' l < r
            l += 1
            r -= 1
            answer += 1

    return answer solve def main():
    N = int(input())
    S = input()
    answer = solve(N, S)
    print(answer) def main():
    N = int(input())
    S = input()
    answer = solve(N, S)
    print(answer) main
#!/usr/bin/env python3


def solve(N, S):
    l = 0
    r = len(S) - 1
    answer = 0
    while l < r:
        if S[l] == "R":
            l += 1
        elif S[r] == "W":
            r -= 1
        else:
            # S[l] == 'W' S[r] == 'R' l < r
            l += 1
            r -= 1
            answer += 1

    return answer


def main():
    N = int(input())
    S = input()
    answer = solve(N, S)
    print(answer)


if __name__ == "__main__":
    main()
