def main():

    N = int(eval(input()))

    S = [s for s in eval(input())]

    ans = 10**9

    w = 0

    r = S.count("R")

    for i in range(N+1):

        ans = min(ans, max(w, r))

        if i == N:

            break

        if S[i] == "W":

            w += 1

        else:

            r -= 1

    print(ans)





if __name__ == '__main__':

    main()

def main():

    _ = int(eval(input()))

    S = eval(input())

    ri = S.count("R")  # 右側の換えるべき個数

    le = 0

    ans = max(ri, le)

    for s in S:

        if s == "R":

            ri -= 1

        else:

            le += 1

        ans = min(ans, max(ri, le))

    print(ans)





if __name__ == '__main__':

    main()

def main():
    N = int(eval(input()))
    S = [s for s in eval(input())]
    ans = 10**9
    w = 0
    r = S.count("R")
    for i in range(N + 1):
        ans = min(ans, max(w, r))
        if i == N:
            break
        if S[i] == "W":
            w += 1
        else:
            r -= 1
    print(ans)


if __name__ == "__main__":
    main()

def main():
    _ = int(eval(input()))
    S = eval(input())
    ri = S.count("R")  # 右側の換えるべき個数
    le = 0
    ans = max(ri, le)
    for s in S:
        if s == "R":
            ri -= 1
        else:
            le += 1
        ans = min(ans, max(ri, le))
    print(ans)


if __name__ == "__main__":
    main()

-    N = int(eval(input())) -    S = [s for s in eval(input())] -    ans = 10**9 -    w = 0 -    r = S.count("R") -    for i in range(N + 1): -        ans = min(ans, max(w, r)) -        if i == N: -            break -        if S[i] == "W": -            w += 1 +    _ = int(eval(input())) +    S = eval(input()) +    ri = S.count("R")  # 右側の換えるべき個数 +    le = 0 +    ans = max(ri, le) +    for s in S: +        if s == "R": +            ri -= 1 -            r -= 1 +            le += 1 +        ans = min(ans, max(ri, le))