def d_alter_altar():

    N = int(eval(input()))

    C = eval(input())



    stone_white_total, stone_red_total = C.count('W'), C.count('R')



    stone_white_left, stone_red_right = [0], [stone_red_total]

    stone_white, stone_red = 0, stone_red_total

    for stone in C:

        if stone == 'W':

            stone_white += 1

        else:

            stone_red -= 1

        stone_white_left.append(stone_white)

        stone_red_right.append(stone_red)



    return min([max(w, r) for w, r in zip(stone_white_left, stone_red_right)])



print((d_alter_altar()))
def d_alter_altar_2():

    N = int(eval(input()))

    C = eval(input())



    left, right = 0, N - 1

    ans = 0

    while left < right:

        while left < right and C[left] == 'R':

            left += 1

        while right >= 0 and C[right] == 'W':

            right -= 1



        if left >= right:

            break

        left += 1

        right -= 1

        ans += 1

    return ans



print((d_alter_altar_2()))
def d_alter_altar():
    N = int(eval(input()))
    C = eval(input())
    stone_white_total, stone_red_total = C.count("W"), C.count("R")
    stone_white_left, stone_red_right = [0], [stone_red_total]
    stone_white, stone_red = 0, stone_red_total
    for stone in C:
        if stone == "W":
            stone_white += 1
        else:
            stone_red -= 1
        stone_white_left.append(stone_white)
        stone_red_right.append(stone_red)
    return min([max(w, r) for w, r in zip(stone_white_left, stone_red_right)])


print((d_alter_altar()))

def d_alter_altar_2():
    N = int(eval(input()))
    C = eval(input())
    left, right = 0, N - 1
    ans = 0
    while left < right:
        while left < right and C[left] == "R":
            left += 1
        while right >= 0 and C[right] == "W":
            right -= 1
        if left >= right:
            break
        left += 1
        right -= 1
        ans += 1
    return ans


print((d_alter_altar_2()))

-def d_alter_altar(): +def d_alter_altar_2(): -    stone_white_total, stone_red_total = C.count("W"), C.count("R") -    stone_white_left, stone_red_right = [0], [stone_red_total] -    stone_white, stone_red = 0, stone_red_total -    for stone in C: -        if stone == "W": -            stone_white += 1 -        else: -            stone_red -= 1 -        stone_white_left.append(stone_white) -        stone_red_right.append(stone_red) -    return min([max(w, r) for w, r in zip(stone_white_left, stone_red_right)]) +    left, right = 0, N - 1 +    ans = 0 +    while left < right: +        while left < right and C[left] == "R": +            left += 1 +        while right >= 0 and C[right] == "W": +            right -= 1 +        if left >= right: +            break +        left += 1 +        right -= 1 +        ans += 1 +    return ans -print((d_alter_altar())) +print((d_alter_altar_2()))