# -*- coding: utf-8 -*-

# template: v1.3.1



import io

import sys

import math



### DEBUG ###

_DEB = 0  # 1:ON / 0:OFF



_INPUT = """\

200000

"""+("R"*200000)

_EXPECTED = """\

2



"""

if _DEB:

    sys.stdin = io.StringIO(_INPUT)

    print("!! Debug Mode !!")



def logd(str):

    if _DEB: print(f"[deb] {str}")





### INPUT ####

n = int(eval(input()))

c = eval(input())

c=c.replace("R","0")

c=c.replace("W","1")

c=[int(x) for x in c]



### Solve ####

def solve():

    # Process

    ans=0

    id1=0

    for i in reversed(list(range(n))):

        if id1 > i:

            break

        id0=-1

        if c[i] == 0:

            id0=i

            not_found=True

            for j in range(id1,id0):

                if c[j]==1:

                    id1=j

                    c[i]=1

                    c[j]=0

                    ans+=1

                    not_found=False

                    break

            if not_found:

                break

                

            if[i]==0:

                c[i]=1

                ans+=1

        



    # OUPUT

    ans = str(ans)

    print(ans)

    return ans



### MAIN ###

if __name__ == "__main__":

    ans = solve()



    # Checker

    if _DEB:

        if _EXPECTED.strip() == ans.strip(): print("\n!! Success !!")

        else: print(f"\n!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")
n=int(eval(input()))

s=eval(input())

li=0

ri=len(s)

cnt=0

while li<ri:

  if s[li] == "W":

    while li<ri:

      ri-=1

      if s[ri] == "R":

        cnt+=1

        break

      

  li+=1

print(cnt)

  
# -*- coding: utf-8 -*-
# template: v1.3.1
import io
import sys
import math

### DEBUG ###
_DEB = 0  # 1:ON / 0:OFF
_INPUT = """\
200000
""" + (
    "R" * 200000
)
_EXPECTED = """\
2
"""
if _DEB:
    sys.stdin = io.StringIO(_INPUT)
    print("!! Debug Mode !!")


def logd(str):
    if _DEB:
        print(f"[deb] {str}")


### INPUT ####
n = int(eval(input()))
c = eval(input())
c = c.replace("R", "0")
c = c.replace("W", "1")
c = [int(x) for x in c]
### Solve ####
def solve():
    # Process
    ans = 0
    id1 = 0
    for i in reversed(list(range(n))):
        if id1 > i:
            break
        id0 = -1
        if c[i] == 0:
            id0 = i
            not_found = True
            for j in range(id1, id0):
                if c[j] == 1:
                    id1 = j
                    c[i] = 1
                    c[j] = 0
                    ans += 1
                    not_found = False
                    break
            if not_found:
                break
            if [i] == 0:
                c[i] = 1
                ans += 1
    # OUPUT
    ans = str(ans)
    print(ans)
    return ans


### MAIN ###
if __name__ == "__main__":
    ans = solve()
    # Checker
    if _DEB:
        if _EXPECTED.strip() == ans.strip():
            print("\n!! Success !!")
        else:
            print(f"\n!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

n = int(eval(input()))
s = eval(input())
li = 0
ri = len(s)
cnt = 0
while li < ri:
    if s[li] == "W":
        while li < ri:
            ri -= 1
            if s[ri] == "R":
                cnt += 1
                break
    li += 1
print(cnt)

-# -*- coding: utf-8 -*- -# template: v1.3.1 -import io -import sys -import math - -### DEBUG ### -_DEB = 0  # 1:ON / 0:OFF -_INPUT = """\ -200000 -""" + ( -    "R" * 200000 -) -_EXPECTED = """\ -2 -""" -if _DEB: -    sys.stdin = io.StringIO(_INPUT) -    print("!! Debug Mode !!") - - -def logd(str): -    if _DEB: -        print(f"[deb] {str}") - - -### INPUT #### -c = eval(input()) -c = c.replace("R", "0") -c = c.replace("W", "1") -c = [int(x) for x in c] -### Solve #### -def solve(): -    # Process -    ans = 0 -    id1 = 0 -    for i in reversed(list(range(n))): -        if id1 > i: -            break -        id0 = -1 -        if c[i] == 0: -            id0 = i -            not_found = True -            for j in range(id1, id0): -                if c[j] == 1: -                    id1 = j -                    c[i] = 1 -                    c[j] = 0 -                    ans += 1 -                    not_found = False -                    break -            if not_found: +s = eval(input()) +li = 0 +ri = len(s) +cnt = 0 +while li < ri: +    if s[li] == "W": +        while li < ri: +            ri -= 1 +            if s[ri] == "R": +                cnt += 1 -            if [i] == 0: -                c[i] = 1 -                ans += 1 -    # OUPUT -    ans = str(ans) -    print(ans) -    return ans - - -### MAIN ### -if __name__ == "__main__": -    ans = solve() -    # Checker -    if _DEB: -        if _EXPECTED.strip() == ans.strip(): -            print("\n!! Success !!") -        else: -            print(f"\n!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}") +    li += 1 +print(cnt)