#from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

from fractions import gcd

from itertools import combinations,permutations,accumulate # (string,3) 3回

#from collections import deque

from collections import deque,defaultdict,Counter

import decimal

import re

#import bisect

#

#    d = m - k[i] - k[j]

#    if kk[bisect.bisect_right(kk,d) - 1] == d:

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#

# my_round_int = lambda x:np.round((x*2 + 1)//2)

# 四捨五入

import sys

sys.setrecursionlimit(10000000)

mod = 10**9 + 7

#mod = 9982443453

def readInts():

  return list(map(int,input().split()))

def I():

  return int(eval(input()))

n = I()

C = eval(input())

flag = False

cnt = 0

for i in range(n):

    if not flag and C[i] == 'W':

        flag = True

    if flag:

        if C[i] == 'R':

            cnt += 1

        # elif C[i] == 'W':

        #     if i + 1 < n:

        #         if C[i+1] == 'W':

        #             pass

        #         else:

        #             cnt = max(cnt-1,0)

        #     else:

        #         cnt = max(cnt-1,0)

r = C.count('R')

w = n-r

nya = 0

for i in range(r,n):

    if C[i] == 'R':

        nya += 1

pya = 0

for i in range(r):

    if C[i] == 'W':

        pya += 1

a = 0

for i in range(n-1):

    if C[i] == 'W' and C[i+1] == 'R':

        a += 1

print((min(max(a,cnt), nya, pya)))

#from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

from fractions import gcd

from itertools import combinations,permutations,accumulate, product # (string,3) 3回

#from collections import deque

from collections import deque,defaultdict,Counter

import decimal

import re

import math

import bisect

import heapq

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#

# my_round_int = lambda x:np.round((x*2 + 1)//2)

# 四捨五入g

#

# インデックス系

# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);

# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);

#

#

import sys

sys.setrecursionlimit(10000000)

mod = 10**9 + 7

#mod = 9982443453

#mod = 998244353

INF = float('inf')

from sys import stdin

readline = stdin.readline

def readInts():

  return list(map(int,readline().split()))

def readTuples():

    return tuple(map(int,readline().split()))

def I():

    return int(readline())

n = I()

s = eval(input())

C = Counter(s)

w,r = 0,0

for k,v in list(C.items()):

    if k == 'W':

        w += v

    else:

        r += v

p = 'R' * r + 'W' * w

ans = 0

for i in range(n):

    if p[i] == s[i]:

        pass

    else:

        ans += 1

print((ans//2))

# from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate  # (string,3) 3回

# from collections import deque
from collections import deque, defaultdict, Counter
import decimal
import re

# import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys

sys.setrecursionlimit(10000000)
mod = 10**9 + 7
# mod = 9982443453
def readInts():
    return list(map(int, input().split()))


def I():
    return int(eval(input()))


n = I()
C = eval(input())
flag = False
cnt = 0
for i in range(n):
    if not flag and C[i] == "W":
        flag = True
    if flag:
        if C[i] == "R":
            cnt += 1
        # elif C[i] == 'W':
        #     if i + 1 < n:
        #         if C[i+1] == 'W':
        #             pass
        #         else:
        #             cnt = max(cnt-1,0)
        #     else:
        #         cnt = max(cnt-1,0)
r = C.count("R")
w = n - r
nya = 0
for i in range(r, n):
    if C[i] == "R":
        nya += 1
pya = 0
for i in range(r):
    if C[i] == "W":
        pya += 1
a = 0
for i in range(n - 1):
    if C[i] == "W" and C[i + 1] == "R":
        a += 1
print((min(max(a, cnt), nya, pya)))

# from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate, product  # (string,3) 3回

# from collections import deque
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import heapq

#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys

sys.setrecursionlimit(10000000)
mod = 10**9 + 7
# mod = 9982443453
# mod = 998244353
INF = float("inf")
from sys import stdin

readline = stdin.readline


def readInts():
    return list(map(int, readline().split()))


def readTuples():
    return tuple(map(int, readline().split()))


def I():
    return int(readline())


n = I()
s = eval(input())
C = Counter(s)
w, r = 0, 0
for k, v in list(C.items()):
    if k == "W":
        w += v
    else:
        r += v
p = "R" * r + "W" * w
ans = 0
for i in range(n):
    if p[i] == s[i]:
        pass
    else:
        ans += 1
print((ans // 2))

-from itertools import combinations, permutations, accumulate  # (string,3) 3回 +from itertools import combinations, permutations, accumulate, product  # (string,3) 3回 +import math +import bisect +import heapq -# import bisect -# -#    d = m - k[i] - k[j] -#    if kk[bisect.bisect_right(kk,d) - 1] == d: -# 四捨五入 +# 四捨五入g +# +# インデックス系 +# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2); +# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2); +# +# +# mod = 998244353 +INF = float("inf") +from sys import stdin + +readline = stdin.readline + + -    return list(map(int, input().split())) +    return list(map(int, readline().split())) + + +def readTuples(): +    return tuple(map(int, readline().split())) -    return int(eval(input())) +    return int(readline()) -C = eval(input()) -flag = False -cnt = 0 +s = eval(input()) +C = Counter(s) +w, r = 0, 0 +for k, v in list(C.items()): +    if k == "W": +        w += v +    else: +        r += v +p = "R" * r + "W" * w +ans = 0 -    if not flag and C[i] == "W": -        flag = True -    if flag: -        if C[i] == "R": -            cnt += 1 -        # elif C[i] == 'W': -        #     if i + 1 < n: -        #         if C[i+1] == 'W': -        #             pass -        #         else: -        #             cnt = max(cnt-1,0) -        #     else: -        #         cnt = max(cnt-1,0) -r = C.count("R") -w = n - r -nya = 0 -for i in range(r, n): -    if C[i] == "R": -        nya += 1 -pya = 0 -for i in range(r): -    if C[i] == "W": -        pya += 1 -a = 0 -for i in range(n - 1): -    if C[i] == "W" and C[i + 1] == "R": -        a += 1 -print((min(max(a, cnt), nya, pya))) +    if p[i] == s[i]: +        pass +    else: +        ans += 1 +print((ans // 2))