import sys

read = sys.stdin.read

def main():

    n = int(eval(input()))

    a = eval(input())

    if not 'WR' in a:

        print((0))

        sys.exit()

    a = list(a)

    rnum = a.count('R')

    rl = 0

    rr = 0

    for i1 in range(rnum):

        rl += a[i1] == 'W'

    for j1 in range(n - rnum):

        rr += a[rnum + j1] == 'R'

    r = max(rl, rr)

    print(r)

if __name__ == '__main__':

    main()

import sys

read = sys.stdin.read

#readlines = sys.stdin.readlines

def main():

    n = int(eval(input()))

    rc = tuple(eval(input()))

    rc2 = [c == 'W' for c in rc]

    r1 = sum(rc2) # 白をすべて赤にした場合

    r2 = n - r1  # 赤をすべて白にした場合。

    r3 = sum(rc2[:r2]) # 赤を左につめるのに邪魔になる白の数

    print((min(r1, r2, r3)))



if __name__ == '__main__':

    main()

import sys

read = sys.stdin.read


def main():
    n = int(eval(input()))
    a = eval(input())
    if not "WR" in a:
        print((0))
        sys.exit()
    a = list(a)
    rnum = a.count("R")
    rl = 0
    rr = 0
    for i1 in range(rnum):
        rl += a[i1] == "W"
    for j1 in range(n - rnum):
        rr += a[rnum + j1] == "R"
    r = max(rl, rr)
    print(r)


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
# readlines = sys.stdin.readlines
def main():
    n = int(eval(input()))
    rc = tuple(eval(input()))
    rc2 = [c == "W" for c in rc]
    r1 = sum(rc2)  # 白をすべて赤にした場合
    r2 = n - r1  # 赤をすべて白にした場合。
    r3 = sum(rc2[:r2])  # 赤を左につめるのに邪魔になる白の数
    print((min(r1, r2, r3)))


if __name__ == "__main__":
    main()

- - +# readlines = sys.stdin.readlines -    a = eval(input()) -    if not "WR" in a: -        print((0)) -        sys.exit() -    a = list(a) -    rnum = a.count("R") -    rl = 0 -    rr = 0 -    for i1 in range(rnum): -        rl += a[i1] == "W" -    for j1 in range(n - rnum): -        rr += a[rnum + j1] == "R" -    r = max(rl, rr) -    print(r) +    rc = tuple(eval(input())) +    rc2 = [c == "W" for c in rc] +    r1 = sum(rc2)  # 白をすべて赤にした場合 +    r2 = n - r1  # 赤をすべて白にした場合。 +    r3 = sum(rc2[:r2])  # 赤を左につめるのに邪魔になる白の数 +    print((min(r1, r2, r3)))