n=int(input())
s = str(input())
r = 0
w = 0
d = 0
for i in range(n):
    if (s[i] == 'R'):
        r += 1
    else:
        w += 1
sd = sorted(s)
for i in range(n):
    if (s[i] != sd[i]):
        d += 1

if (w == 0 or r == 0):
    print(0)
else:
    print(min(r, w, int(d/2)))
 n=int(input()) n int(input()) int input() input s = str(input()) s str(input()) str input() input r = 0 r 0 w = 0 w 0 d = 0 d 0 for i in range(n):
    if (s[i] == 'R'):
        r += 1
    else:
        w += 1 i range(n) range n if (s[i] == 'R'):
        r += 1
    else:
        w += 1 s[i] == 'R' s[i] s i 'R' r += 1 r 1 w += 1 w 1 sd = sorted(s) sd sorted(s) sorted s for i in range(n):
    if (s[i] != sd[i]):
        d += 1 i range(n) range n if (s[i] != sd[i]):
        d += 1 s[i] != sd[i] s[i] s i sd[i] sd i d += 1 d 1 if (w == 0 or r == 0):
    print(0)
else:
    print(min(r, w, int(d/2))) w == 0 or r == 0 w == 0 w 0 r == 0 r 0 print(0) print 0 print(min(r, w, int(d/2))) print min(r, w, int(d/2)) min r w int(d/2) int d/2 d 2 d += 1 1 d r += 1 1 r n=int(input()) int(input()) n r = 0 0 r w += 1 1 w d = 0 0 d s = str(input()) str(input()) s sd = sorted(s) sorted(s) sd w = 0 0 w
n=int(input())
s = str(input())
r = 0
w = 0
d = 0
for i in range(n):
    if (s[i] == 'R'):
        r += 1
    else:
        w += 1
sd = sorted(s)
for i in range(n):
    if (s[i] != sd[i]):
        d += 1

if (w == 0 or r == 0):
    print(0)
else:
    print(min(r, w, int(d/2)))

