import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
C = rs()

l, r = 0, N-1
ans = 0
while l < r:
	while C[l] == 'R' and l < N-1:
		l += 1
	while C[r] == 'W' and r > 0:
		r -= 1
	if l >= r: break
	l += 1
	r -= 1
	ans += 1
print(ans) import sys, math sys math from collections import defaultdict, deque, Counter from bisect import bisect_left, bisect_right from itertools import combinations, permutations, product from heapq import heappush, heappop from functools import lru_cache input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline rs = lambda: input().strip() rs lambda: input().strip() input().strip() ().strip () input strip ri = lambda: int(input()) ri lambda: int(input()) int(input()) int input() input rl = lambda: list(map(int, input().split())) rl lambda: list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split [v]*y for _ in range(x) for _ in range(x) _ range(x) range x for _ in range(x) [v]*y [v] v y mat = lambda x, y, v: [[v]*y for _ in range(x)] mat lambda x, y, v: [[v]*y for _ in range(x)] [[v]*y for _ in range(x)] x y v mat(y, z, v) for _ in range(x) for _ in range(x) _ range(x) range x for _ in range(x) mat(y, z, v) mat y z v ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)] ten lambda x, y, z, v: [mat(y, z, v) for _ in range(x)] [mat(y, z, v) for _ in range(x)] x y z v mod = 1000000007 mod 1000000007 sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 N = ri() N ri() ri C = rs() C rs() rs l, r = 0, N-1 l 0 r N-1 N 1 ans = 0 ans 0 while l < r:
	while C[l] == 'R' and l < N-1:
		l += 1
	while C[r] == 'W' and r > 0:
		r -= 1
	if l >= r: break
	l += 1
	r -= 1
	ans += 1 l < r l r while C[l] == 'R' and l < N-1:
		l += 1
	 C[l] == 'R' and l < N-1 C[l] == 'R' C[l] C l 'R' l < N-1 l N-1 N 1 l += 1 l 1 while C[r] == 'W' and r > 0:
		r -= 1
	 C[r] == 'W' and r > 0 C[r] == 'W' C[r] C r 'W' r > 0 r 0 r -= 1 r 1 if l >= r: break
	 l >= r l r l += 1 l 1 r -= 1 r 1 ans += 1 ans 1 print(ans) print ans N = ri() ri() N ans += 1 1 ans ri = lambda: int(input()) lambda: int(input()) ri mod = 1000000007 1000000007 mod r -= 1 1 r C = rs() rs() C l += 1 1 l rs = lambda: input().strip() lambda: input().strip() rs rl = lambda: list(map(int, input().split())) lambda: list(map(int, input().split())) rl r = 0, N-1 N-1 r r -= 1 1 r l += 1 1 l input = sys.stdin.readline sys.stdin.readline input mat = lambda x, y, v: [[v]*y for _ in range(x)] lambda x, y, v: [[v]*y for _ in range(x)] mat ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)] lambda x, y, z, v: [mat(y, z, v) for _ in range(x)] ten l, r = 0, N-1 0 l ans = 0 0 ans
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
C = rs()

l, r = 0, N-1
ans = 0
while l < r:
	while C[l] == 'R' and l < N-1:
		l += 1
	while C[r] == 'W' and r > 0:
		r -= 1
	if l >= r: break
	l += 1
	r -= 1
	ans += 1
print(ans)