An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; R stands for red and W stands for white.
You can do the following two kinds of operations any number of times in any order:
 - Choose two stones (not necessarily adjacent) and swap them.
 - Choose one stone and change its color (from red to white and vice versa).
According to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?

-----Constraints-----
 - 2 \leq N \leq 200000
 - c_i is R or W.

-----Input-----
Input is given from Standard Input in the following format:
N
c_{1}c_{2}...c_{N}

-----Output-----
Print an integer representing the minimum number of operations needed.

-----Sample Input-----
4
WWRR

-----Sample Output-----
2

For example, the two operations below will achieve the objective.
 - Swap the 1-st and 3-rd stones from the left, resulting in RWWR.
 - Change the color of the 4-th stone from the left, resulting in RWWW.

Difficulty: MEDIUM

Solutions:
N = int(input())
c = str(input())
w = c.count('W')
rr = c[-w:].count('R')
print(min(w, N - w, rr))


N = int(input())
C = input()
r = C.count('R')
ans = C[:r].count('W')
print(ans)


n = int(input())
c = input()
a = c.count('R')
print(a - c[:a].count('R'))


n = int(input())
S = input()
c = S.count('R')
s = S[:c].count('R')
print(c - s)


(N, c) = (input(), input())
print(c[:c.count('R')].count('W'))


n = int(input())
c = list(input())
r = c.count('R')
wr = c[:r].count('W')
print(wr)


N = int(input())
s = input()
num_R = s.count('R')
print(s[:num_R].count('W'))


n = int(input())
s = input()
n_r = s.count('R')
n_r_l = s[:n_r].count('R')
print(n_r - n_r_l)


def main():
	n = int(input())
	s = input()
	rcount = s.count('R')
	diff = s[0:rcount].count('W')
	print(diff)

def __starting_point():
	main()
__starting_point()


n = int(input())
c = list(input())
rn = c.count('R')
rnl = c[:rn].count('R')
print(rn - rnl)


N = int(input())
C = input()
red_num = str.count(C, 'R')
white_num_left = str.count(C[:red_num], 'W')
min_ope = white_num_left
print(min_ope)


N = int(input())
C = input()
R = C.count('R')
ans = C[R:].count('R')
print(ans)


n = int(input())
c = input()
a = c.count('R')
d = c[:a]
b = d.count('R')
print(a - b)


n = int(input())
s = input()
rcnt = s.count('R')
wcnt = s[:rcnt].count('W')
print(wcnt)


N = int(input())
C = input()
a = C.count('R')
b = C[:a].count('R')
print(a - b)


N = int(input())
S = str(input())
P = S.count('R')
D = S[0:P]
Q = D.count('R')
print(P - Q)


def solve(string):
	(_, c) = string.split()
	r = c.count('R')
	return str(c[:r].count('W'))

def __starting_point():
	import sys
	print(solve(sys.stdin.read().strip()))
__starting_point()


N = int(input())
c = input()
rl = c.count('R')
wf = c[:rl].count('W')
print(wf)


n = int(input())
C = list(input())
if 'R' not in C:
	print(0)
	return
W = C.count('W')
R = C.count('R')
w = 0
r = R
ans = float('inf')
for c in C:
	if c == 'W':
		w += 1
	else:
		r -= 1
	ans = min(ans, max(w, r))
print(ans)


n = int(input())
s = input()
red = s.count('R')
print(red - s[:red].count('R'))


import sys
N = int(input())
S = list(input())
c = min(S.count('R'), S.count('W'))
r = 0
count = 0
for l in range(N - c):
	if S[l] == 'W':
		for i in range(r, len(S) - c):
			if S[-(i + 1)] == 'R':
				S[-(i + 1)] = 'W'
				S[l] = 'R'
				count += 1
				break
			r = i
print(count)


import copy

def swap(data, i1, i2):
	tmp = data[i1]
	tmp2 = data[i2]
	data[i2] = tmp
	data[i1] = tmp2
	return data

def check_finish(data):
	out = True
	for i in range(len(data) - 1):
		if data[i] == 'W' and data[i + 1] == 'R':
			out = False
			return out
	return out

def __starting_point():
	n = int(input())
	c = list(input())
	if 'R' not in c:
		print(0)
	elif 'W' not in c:
		print(0)
	else:
		w_count = c.count('W')
		r_count = c.count('R')
		same_r_count = 0
		for i in range(r_count):
			if c[i] == 'R':
				same_r_count += 1
		A = r_count - same_r_count
		print(A)
__starting_point()


a = int(input())
b = input()
n = b.count('R')
m = b[0:n]
ans = m.count('W')
print(ans)


N = int(input())
c = input()
w = 0
r = c.count('R')
Cand = {r}
for i in range(N):
	if c[i] == 'R':
		r -= 1
	else:
		w += 1
	Cand.add(max(w, r))
print(min(Cand))


n = int(input())
c = input()
nr = c.count('R')
nr2 = c[:nr].count('R')
print(nr - nr2)


n = int(input())
c = input()
r = c.count('R')
ans = r - c[:r].count('R')
print(ans)


n = int(input())
s = input()
c = s.count('R')
print(s[:c].count('W'))


N = int(input())
C = input()
count_R = C.count('R')
print(C[:count_R].count('W'))


from collections import Counter
n = int(input())
c = list(input())
num = Counter(c)
r = num['R']
ans = ['R'] * r + ['W'] * (n - r)
cnt = 0
for i in range(n):
	if c[i] != ans[i]:
		cnt += 1
print(cnt // 2)


n = int(input())
c = input()
i = c.count('R')
j = c.count('W', 0, i)
print(j)


N = int(input())
S = input()
x = S.count('W')
y = S[N - x:].count('W')
print(x - y)


n = int(input())
s = input()
res = 0
tem = s.find('WR')
if tem == -1:
	print(res)
else:
	(i, j) = (0, len(s) - 1)
	while i < j:
		while i < j and s[i] != 'W':
			i += 1
		while i < j and s[j] != 'R':
			j -= 1
		if s[i] == 'W' and s[j] == 'R':
			res += 1
			i += 1
			j -= 1
	print(res)


n = int(input())
C = input()
r_all = C.count('R')
move = [0] * (n + 1)
w = 0
r = r_all
move[0] = max(0, r_all)
for (idx, c) in enumerate(C):
	if c == 'W':
		w += 1
	else:
		r -= 1
	move[idx + 1] = max(w, r)
ans = min(move)
print(ans)


def __starting_point():
	n = int(input())
	s = list(input())
	ss = sorted(s)
	cnt = 0
	if 'W' in s:
		sind = ss.index('W')
		cnt = 0
		for i in range(sind):
			if s[i] == 'W':
				cnt += 1
	print(cnt)
__starting_point()


n = int(input())
s = input()
r = s.count('R')
ans = 0
for i in range(r):
	if s[i] == 'W':
		ans += 1
print(ans)


n = int(input())
ccc = input()
cnt_r = ccc.count('R')
ans = 0
for i in range(cnt_r):
	if ccc[i] == 'W':
		ans += 1
print(ans)


n = int(input())
c = list(input())
s = c.count('W')
d = c[:n - s].count('W')
print(d)


n = int(input())
c = input()
r = c.count('R')
x = c[:r]
print(x.count('W'))


N = int(input())
C = list(input())
rednum = C.count('R')
rednumleft = 0
for i in range(rednum):
	if C[i] == 'R':
		rednumleft += 1
print(rednum - rednumleft)


n = int(input())
s = input()
r = s.count('R')
print(r - s[:r].count('R'))


n = int(input())
c = list(input())
hrcnt = 0
rcnt = 0
for i in range(len(c)):
	if c[i] == 'R':
		rcnt += 1
for i in range(len(c)):
	if i + 1 <= rcnt and c[i] == 'R':
		hrcnt += 1
wcnt = len(c) - rcnt
if rcnt == len(c) or rcnt == 0:
	ans = 0
else:
	ans = rcnt - hrcnt
print(ans)


N = int(input())
c = input()
R_num = c.count('R')
c_ext = c[:R_num]
W_num = c_ext.count('W')
print(W_num)


N = int(input())
S = input()
c = S.count('R')
res = S[c:].count('R')
print(res)


(n, c) = (input(), input())
print(c[:c.count('R')].count('W'))


_ = int(input())
C = input()
print(C[C.count('R'):].count('R'))


N = int(input())
C = input()
W = C.count('W')
a = C[N - W:N].count('W')
print(W - a)


n = int(input())
mozi = input()
a_list = []
for i in range(n):
	if mozi[i] == 'W':
		a_list.append(0)
	else:
		a_list.append(1)
r_count = sum(a_list)
print(r_count - sum(a_list[0:r_count]))


n = int(input())
c = input()
cnt = 0
r = c.count('R')
r_s = c[:r].count('R')
print(r - r_s)


from bisect import bisect_left
import sys
N = int(input())
c = input().strip()
ans = 0
w = [i for (i, x) in enumerate(c) if x == 'W']
r = [i for (i, x) in enumerate(c) if x == 'R']
w_num = len(w)
r_num = len(r)
ans = bisect_left(r, r_num)
print(r_num - ans)


n = int(input())
cs = input()
w_count = 0
for c in cs:
	if c == 'W':
		w_count += 1
if w_count == 0:
	print(0)
	return
rest = cs[-w_count:]
answer = 0
for c in rest:
	if c == 'R':
		answer += 1
print(answer)


N = int(input())
C = input()
rCnt = C.count('R')
tmp = C[0:rCnt]
print(tmp.count('W'))


N = int(input())
s = input()
r_count = s.count('R')
new_s = s[:r_count]
print(new_s.count('W'))


(_, t) = open(0)
print(t[:t.count('R')].count('W'))


N = int(input())
C = list(input())
rcnt = C.count('R')
res = C[rcnt:].count('R')
print(res)


n = int(input())
c = list(input())
l = c[:c.count('R')]
print(l.count('W'))


n = int(input())
c = input()
r = c.count('R')
ans = c[0:r].count('W')
print(ans)


N = int(input())
c = input()
c = list(c)
t = True
i = 0
j = N - 1
count = 0
while t:
	if c[i] == 'R':
		i += 1
	elif c[j] == 'W':
		j -= 1
	elif c[i] == 'W' and c[j] == 'R':
		c[i] = 'R'
		c[j] = 'W'
		count += 1
	if i >= j:
		t = False
		break
print(count)


n = int(input())
c = input()
d = c.count('R')
e = c[:d].count('R')
print(d - e)


N = int(input())
stone = input()
R = stone.count('R')
ans = stone.count('W', 0, R)
print(ans)


N = int(input())
c = str(input())
count_red = 0
flag_red = []
for i in c:
	if i == 'W':
		flag_red.append(0)
	else:
		flag_red.append(1)
		count_red += 1
if count_red == 0:
	ans = 0
else:
	ans = count_red - sum(flag_red[0:count_red])
print(ans)


input()
problem = input()
stones = []
rs = []
W = 0
R = 0
for s in problem:
	if s == 'R':
		stones.append(1)
		R += 1
	else:
		stones.append(0)
rs.append(max(W, R))
for i in range(len(stones)):
	if stones[i] == 0:
		W += 1
	else:
		R -= 1
	rs.append(max(W, R))
print(min(rs))


n = int(input())
li_c = input()
r_index = [i for (i, x) in enumerate(li_c) if x == 'R']
w_index = [i for (i, x) in enumerate(li_c) if x == 'W']
r_num = len(r_index)
w_num = len(w_index)
R = r_num
W = 0
ans = max(R, W)
for i in range(n):
	if li_c[i] == 'R':
		R -= 1
	else:
		W += 1
	ans = min(ans, max(R, W))
print(ans)


s = input()
s = input()
R_num = s.count('R')
print(s[:R_num].count('W'))


import sys

def input():
	return sys.stdin.readline().rstrip()
from collections import Counter

def main():
	n = int(input())
	C = input()
	C_cunt = Counter(C)
	cunt_r = C_cunt['R']
	ans = 0
	for i in range(cunt_r):
		if C[i] == 'W':
			ans += 1
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
s = input()
a = s.count('R')
b = s[:a].count('R')
print(a - b)


n = int(input())
k = input()
a = k.count('R')
b = k[:a].count('W')
print(b)


N = int(input())
c = input()
num_red = c.count('R')
print(num_red - c[:num_red].count('R'))


(n, s) = (int(input()), input())
print(min([s.count('W'), s.count('R'), s[:s.count('R')].count('W')]))


import math
import collections
import itertools
import copy

def YesNo(Bool):
	if Bool:
		print('Yes')
	else:
		print('No')
	return

def resolve():
	N = int(input())
	C = input()
	l = 0
	r = N - 1
	lfound = False
	rfound = False
	cnt = 0
	while True:
		if C[l] == 'W':
			lfound = True
		else:
			l += 1
		if C[r] == 'R':
			rfound = True
		else:
			r -= 1
		if rfound and lfound:
			cnt += 1
			l += 1
			r -= 1
			rfound = False
			lfound = False
		if l >= r:
			break
	print(cnt)
resolve()


n = int(input())
c = input()
w = c.count('W')
r = c.count('R')
ans = 0
for i in range(r):
	if c[i] == 'W':
		ans += 1
print(ans)


n = int(input())
c = list(input())
rcnt = 0
allrcnt = 0
for i in range(len(c)):
	if c[i] == 'R':
		allrcnt += 1
for i in range(len(c)):
	if i + 1 <= allrcnt and c[i] == 'R':
		rcnt += 1
ans = allrcnt - rcnt
print(ans)


N = int(input())
c = input()
R = c.count('R')
RR = c[0:R].count('R')
print(min(R - RR, R, N - R))


n = int(input())
c = input()
a = c.count('R')
b = c[:a].count('W')
print(b)


n = int(input())
s = input()
w = s.count('W')
r = s.count('R')
ans = 10 ** 9
if w == 0 or r == 0:
	print(0)
	return
(left_white, right_red) = (0, r)
for i in range(n):
	if s[i] == 'W':
		left_white += 1
	else:
		right_red -= 1
	ans = min(ans, max(left_white, right_red))
print(ans)


N = int(input())
c = str(input())
R = c.count('R')
W = c[:R].count('W')
print(W)


n = int(input())
c = input()
ans = c.count('R')
ans = min(ans, c[:ans].count('W'))
print(ans)


N = int(input())
S = list(input())
r = S.count('R')
T = S[0:r]
print(r - T.count('R'))


n = int(input())
rw = input()
red = rw.count('R')
ans = rw[:red].count('W')
print(ans)


N = int(input())
c = list(input())
R = c.count('R')
L = c[:R].count('R')
print(R - L)


n = int(input())
s = input()
w = s.count('W')
print(w - s[-w:].count('W'))


from collections import Counter
N = int(input())
c = input()
cntr = Counter(c)
ans = 0
for (c, r) in zip(c, 'R' * cntr['R']):
	if c != r:
		ans += 1
print(ans)


n = int(input())
c = str(input())
cc = c[:c.count('R')]
print(cc.count('W'))


n = int(input())
s = input()
m = s.count('R')
print(s[:m].count('W'))


n = int(input())
c = input()
r_cnt = c.count('R')
print(c[:r_cnt].count('W'))


n = int(input())
c = input()
cnt = c.count('R')
ans = c[:cnt].count('W')
print(ans)


N = int(input())
C = input()
R = C.count('R')
C2 = C[0:R]
R2 = C2.count('R')
print(R - R2)


n = int(input())
s = input()
cR = s.count('R')
cW = n - cR
print(s[cR:].count('R'))


N = int(input())
C = input()
R_cnt = C.count('R')
x = C[:R_cnt].count('R')
print(R_cnt - x)


n = int(input())
x = list(input())
sx = len(set(x))
if sx == 1:
	print(0)
	return
cnt_r = x.count('R')
cnt = 0
for i in range(cnt_r):
	if x[i] == 'W':
		cnt += 1
print(cnt)


n = int(input())
c = list(input())
n = c.count('R')
m = c[:n]
print(n - m.count('R'))


n = int(input())
C = list(input())
Nr = C.count('R')
ans = C[:Nr].count('W')
print(ans)


_ = input()
c = input()
r_num = c.count('R')
print(c[:r_num].count('W'))


(n, s) = (input(), input())
print(s[:s.count('R')].count('W'))


N = int(input())
S = input()
a = S.count('W')
b = S.count('R')
print(min([S[:b].count('W'), a, b]))


N = int(input())
s = input()
R = 0
for i in range(N):
	if s[i] == 'R':
		R += 1
W = 0
ans = R
for i in range(N):
	if s[i] == 'R':
		R -= 1
	else:
		W += 1
	ans = min(ans, max(W, R))
print(ans)


n = int(input())
C = input()
print(C[:C.count('R')].count('W'))


N = int(input())
S = input()
a = S.count('R')
print(S[:a].count('W'))


N = int(input())
c = input()
countR = c.count('R')
print(c[:countR].count('W'))


n = int(input())
c = input()
red = c.count('R')
ok = c[:red].count('R')
print(red - ok)


n = int(input())
wr = input()
R_cnt = wr.count('R')
ans = wr.count('W', 0, R_cnt)
print(ans)


import sys
n = int(input())
s = input()
r = s.count('R')
print(r - s.count('R', 0, r))


K = int(input())
c = input()
P = c.count('R')
R = P - c[:P].count('R')
print(R)


n = int(input())
s = input()
r = s.count('R')
w = s.count('W')
print(s[0:r].count('W'))


N = int(input())
a = list(input())
x = a.count('R')
b = a[:x]
print(b.count('W'))


n = input()
i = list(input())
Wn = i.count('W')
print(Wn - i[len(i) - Wn:].count('W'))


n = int(input())
al = list(input())
cr = al.count('R')
print(al[:cr].count('W'))


N = int(input())
c = input()
r = c.count('R')
print(min(c[:r].count('W'), c[r:].count('R')))


k = input()
cs = input()
rs = cs.count('R')
print(cs[:rs].count('W'))


from collections import Counter
n = int(input())
c = list(input())
d = Counter(c)
e = Counter(c[:d['R']])
print(d['R'] - e['R'])


n = int(input())
l = input()
rs = l.count('R')
print(l[:rs].count('W'))


n = int(input())
c = input()
t = c.count('R')
print(t - c[:t].count('R'))


N = int(input())
c = list(input())
r = c.count('R')
rr = c[:r].count('R')
print(r - rr)


n = int(input())
s = input()
w = s.count('W')
print(0 if w == 0 else s[-w:].count('R'))


n = int(input())
s = input()
check = s.count('R')
q = s[:check]
print(q.count('W'))


n = int(input())
C = list(input())
(a, b) = (0, 0)
for i in range(n):
	if C[i] == 'R':
		a += 1
	ans = max(a, b)
for i in range(n):
	if C[i] == 'R':
		a -= 1
	else:
		b += 1
	tmp = max(a, b)
	ans = min(ans, tmp)
print(ans)


N = int(input())
C = input()
R = C.count('R')
ans = 0
for r in range(R):
	if C[r] == 'W':
		ans += 1
print(ans)


def main():
	n = int(input())
	c = str(input())
	w_count = 0
	for i in range(n):
		if c[i] == 'W':
			w_count += 1
	w_count_ano = 0
	for i in range(w_count):
		if c[-1 - i] == 'W':
			w_count_ano += 1
	count = w_count - w_count_ano
	print(count)

def __starting_point():
	main()
__starting_point()


n = int(input())
c = input()
cnt_r = c.count('R')
print(c[:cnt_r].count('W'))


n = int(input())
c = input()
k = c.count('R')
print(c[:k].count('W'))


import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10 ** 9

def main():
	n = int(input())
	c = list(input())
	(l, r) = (0, len(c) - 1)
	result = 0
	while r - l > 0:
		if c[l] == 'W' and c[r] == 'R':
			(c[l], c[r]) = (c[r], c[l])
			result += 1
		if c[r] == 'W':
			r -= 1
		if c[l] == 'R':
			l += 1
	print(result)

def __starting_point():
	main()
__starting_point()


N = int(input())
c = list(input())
w = 0
r = N - 1
ans = 0
while w < r:
	for i in range(w, r):
		if c[i] == 'W':
			c[i] = 'R'
			w = i
			break
	else:
		break
	for j in range(r, w, -1):
		if c[j] == 'R':
			c[j] = 'W'
			r = j
			break
	else:
		break
	ans += 1
print(ans)


N = int(input())
S = input()
ls = [0 for _ in range(N)]
for i in range(N):
	if S[i] == 'W':
		ls[i] = 1
ans = 0
i = 0
j = N - 1
while True:
	if ls[i] == 1 and ls[j] == 0:
		ls[i] = 0
		ls[j] = 1
		i += 1
		j -= 1
		ans += 1
	elif ls[i] == 0 and ls[j] == 0:
		i += 1
	elif ls[i] == 1 and ls[j] == 1:
		j -= 1
	else:
		i += 1
		j -= 1
	if i >= j:
		break
print(ans)


N = int(input())
C = input()
Rc = C.count('R')
leftRc = C[:Rc].count('R')
print(Rc - leftRc)


n = int(input())
s = str(input())
print(s[:s.count('R')].count('W'))


n = int(input())
c = input()
print(c.count('W') - c[n - c.count('W'):].count('W'))


n = input()
c = input()
a = c.count('R')
b = c[:a].count('R')
print(a - b)


N = int(input())
c = input()
R_r = c.count('R')
W_l = 0
ans = N
for i in range(N + 1):
	t = max(R_r, W_l)
	ans = min(ans, t)
	if R_r == 0:
		break
	if c[i] == 'R':
		R_r -= 1
	else:
		W_l += 1
print(ans)


N = int(input())
str = input()
r_sum = 0
for i in range(N):
	if str[i] == 'R':
		r_sum += 1
r_sum2 = 0
for i in range(r_sum):
	if str[i] == 'R':
		r_sum2 += 1
print(r_sum - r_sum2)


n = int(input())
s = input()
ans = s.count('R')
fans = s[0:ans].count('R')
print(ans - fans)


n = int(input())
hoge = input()
r = hoge.count('R')
print(min(hoge[:r].count('W'), hoge[r:].count('R')))


n = int(input())
c = input()
cntR = c.count('R')
print(c[:cntR].count('W'))


N = int(input())
c = input()
rCount = c.count('R')
wCount = c[0:rCount].count('W')
print(wCount)


n = int(input())
alis = list(input())
t = alis.count('R')
print(alis[0:t].count('W'))


n = input()
k = input()
a = k.count('R')
print(k[:a].count('W'))


n = int(input())
c = input()
wc = c.count('W')
rc = c.count('R')
print(c[:rc].count('W'))


a = int(input())
s = input()
ans = a
w_to_r = 0
r_to_w = s.count('R')
ans = min(ans, max(w_to_r, r_to_w))
for i in range(a):
	if s[i] == 'W':
		w_to_r += 1
	else:
		r_to_w -= 1
	ans = min(ans, max(w_to_r, r_to_w))
print(ans)


n = int(input())
C = input()
r = C.count('R')
print(r - C[:r].count('R'))


n = int(input())
C = list(input())
r = C.count('R')
s = C[0:r].count('R')
print(r - s)


n = int(input())
c = input()
rc = c.count('R')
print(c[rc:].count('R'))


n = int(input())
if n == 0:
	exit()
st = input()
r = st.count('R')
print(st[:r].count('W'))


n = int(input())
c = input()
r = c.count('R')
cc = c[:r]
print(cc.count('W'))


n = int(input())
s = input()
k = s.count('R')
t = s[:k].count('R')
print(k - t)


N = int(input())
C = list(input())
r = C.count('R')
print(r - C[:r].count('R'))


N = int(input())
c = list(input())
rn = c.count('R')
print(c[:rn].count('W'))


n = int(input())
c = input()
r = c.count('R')
w = c.count('W')
print(c[:r].count('W'))


N = input()
c = input()
R_count = c.count('R')
W_count = c[:R_count].count('W')
print(W_count)


n = int(input())
C = list(input())
ans = 0
N = n - 1
for l in range(n):
	if C[l] == 'W':
		for r in range(N, 0, -1):
			if r <= l:
				print(ans)
				return
			if C[r] == 'R':
				C[l] = 'R'
				C[r] = 'W'
				ans += 1
				N = r - 1
				break
print(ans)


n = int(input())
c = input()
cnt = c.count('R')
c_short = c[:cnt]
print(c_short.count('W'))


n = int(input())
c = input()
w = 0
r = c.count('R')
i = 0
ans = max(w, r)
while i <= n - 1:
	if c[i] == 'W':
		w += 1
	else:
		r -= 1
	ans = min(ans, max(w, r))
	i += 1
print(ans)


N = int(input())
C = list(input())
Rn = C.count('R')
print(C[:Rn].count('W'))


n = int(input())
C = list(input())
r_num = C.count('R')
ans = C[:r_num].count('W')
print(ans)


n = int(input())
stone = input()
r = stone.count('R')
print(stone.count('W', 0, r))


a = map(int, input())
b = input()
c = b.count('R')
d = b.count('W', 0, c)
print(d)


n = int(input())
cl = input()
if cl[:cl.count('R')].count('W') != 0:
	print(min(cl[:cl.count('R')].count('W'), cl.count('R')))
else:
	print(0)


n = int(input())
A = list(input())
r = A.count('R')
ans = A[:r].count('W')
print(ans)


n = int(input())
c = input()
cnt = [0 for _ in range(n)]
red = 0
for i in range(n):
	if c[i] == 'R':
		red += 1
	cnt[i] = red
print(red - cnt[red - 1])


N = int(input())
c = list(input())
Rn = c.count('R')
Wn = 0
ans = N
for i in range(N + 1):
	if i == 0:
		ans = Rn
	else:
		if c[i - 1] == 'R':
			Rn -= 1
		else:
			Wn += 1
		ans = min(ans, min(Rn, Wn) + abs(Rn - Wn))
print(ans)


n = int(input())
c = input()
x = c.count('R')
c2 = c[:x]
ans = c2.count('W')
print(ans)


(_, C) = (input(), input())
a = C.count('R')
print(a - C[:a].count('R'))


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(rs())

def rs_():
	return [_ for _ in rs().split()]

def ri_():
	return [int(_) for _ in rs().split()]
N = ri()
c = list(rs())
ans = 0
s = 0
e = N - 1
while True:
	while c[s] == 'R' and s < e:
		s += 1
	while c[e] == 'W' and s < e:
		e -= 1
	if s == e:
		break
	else:
		c[s] = 'R'
		c[e] = 'W'
		ans += 1
print(ans)


n = int(input())
s = input()
rs = s.count('R')
oks = s[:rs].count('R')
print(rs - oks)


N = int(input())
S = input()
r = S.count('R')
ans = r - S[:r].count('R')
print(ans)


N = int(input())
A = input()
a = A.count('R')
b = A.count('W', 0, a)
print(b)


n = int(input())
s = list(input())
print(s[:s.count('R')].count('W'))


N = int(input())
C = input()
rw = C.count('R')
wr = 0
ans = rw
for i in range(N):
	if C[i] == 'R':
		rw -= 1
	else:
		wr += 1
	ans = min(ans, max(rw, wr))
print(ans)


def solve1(n: int, c: str) -> int:
	ans = 0
	(r, w) = (0, 0)
	for i in range(n):
		if c[i] == 'R':
			r += 1
		else:
			w += 1
	s_pivot = c[:r] + '|' + c[r:]
	s_check = ' ' * r + '|'
	for i in range(r, n):
		if c[i] == 'R':
			ans += 1
			s_check += 'X'
		else:
			s_check += ' '
	return ans
n = int(input())
c = input()
print(solve1(n, c))


number = int(input())
date = input()
date = list(date)
cnt = 0
cnt2 = 0
for i in range(number):
	if date[i] == 'R':
		cnt += 1
for s in range(cnt):
	if date[s] == 'W':
		cnt2 += 1
print(cnt2)


N = int(input())
c = input()
t = c.count('R')
p = c[:t].count('W')
print(p)


N = int(input())
C = input()
n = C.count('R')
print(n - C[:n].count('R'))


n = int(input())
a = list(input())
c = a.count('W')
b = a[:n - c]
d = b.count('W')
print(d)


n = int(input())
c = str(input())
ans = 0
r_cnt = c.count('R')
for i in range(r_cnt):
	if c[i] == 'W':
		ans += 1
print(ans)


import sys
import re
import queue
import collections
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input():
	return int(input())

def i_map():
	return map(int, input().split())

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def lcm(a, b):
	return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
	N = i_input()
	C = s_input()
	c = []
	for i in range(0, N):
		c.append(C[i])
	answer = 40000000
	tmp = 0
	for i in range(0, N):
		if c[i] == 'R':
			tmp += 1
	answer = min(answer, tmp)
	tmp = 0
	for i in range(0, N):
		if c[i] == 'W':
			tmp += 1
	answer = min(answer, tmp)
	whiteCount = 0
	redCount = 0
	for i in range(0, N):
		if c[i] == 'R':
			redCount += 1
	whiteCount = N - redCount
	leftWhiteCount = 0
	rightRedCount = redCount
	for i in range(0, N):
		if c[i] == 'W':
			leftWhiteCount += 1
		else:
			rightRedCount += -1
		answer = min(answer, max(leftWhiteCount, rightRedCount))
	print(answer)
	return

def __starting_point():
	main()
__starting_point()


n = int(input())
cs = input()
print(cs[:cs.count('R')].count('W'))


import heapq

def main():
	N = int(input())
	C = list(input())
	R = []
	W = []
	for (i, c) in enumerate(C):
		if c == 'R':
			R.append(-i)
		else:
			W.append(i)
	if len(R) == 0 or len(W) == 0:
		print(0)
		return
	heapq.heapify(R)
	heapq.heapify(W)
	ans = 0
	while True:
		max_r = -1 * heapq.heappop(R)
		min_w = heapq.heappop(W)
		if max_r < min_w:
			break
		else:
			heapq.heappush(R, -min_w)
			heapq.heappush(W, max_r)
			ans += 1
	print(ans)

def __starting_point():
	main()
__starting_point()


N = int(input())
s = str(input())
a = 0
b = 0
for i in range(N):
	if s[i] == 'R':
		a = a + 1
ans = max(a, b)
for i in range(N):
	if s[i] == 'R':
		a = a - 1
	else:
		b = b + 1
	now = max(a, b)
	ans = min(ans, now)
print(ans)


n = int(input())
c = list(input())
cnt = 0
allcnt = c.count('R')
for i in range(allcnt):
	if c[i] == 'R':
		cnt += 1
print(allcnt - cnt)


N = int(input())
S = input()
scnt = S.count('R')
print(S[:scnt].count('W'))


from collections import Counter
N = int(input())
s = input()
c = Counter(s)
(w, r) = (0, c['R'])
ans = max(w, r)
for i in range(N):
	if s[i] == 'W':
		w += 1
	else:
		r -= 1
	ans = min(ans, max(w, r))
print(ans)


n = int(input())
c = input()
r_cnt = c.count('R')
ans = r_cnt - c[0:r_cnt].count('R')
print(ans)


N = int(input())
c = list(input())
cnt = c.count('R')
b = c[cnt:]
print(b.count('R'))


import collections
n = int(input())
wr = list(input())
cc = collections.Counter(wr)
r = cc['R']
ans = wr[:r].count('W')
print(ans)


N = int(input())
C = input()
Nw = C.count('W')
Nr = N - Nw
print(Nw - C[-1 * Nw:].count('W'))


n = int(input())
c = list(input())
r = c.count('R')
r2 = c[:r].count('R')
print(r - r2)


n = int(input())
s = str(input())
c = s.count('R')
print(s[c:].count('R'))


N = int(input())
ln = input()
n = ln.count('R')
m = ln[:n]
print(m.count('W'))


n = int(input())
c = input()
x = 0
for i in range(n):
	if c[i] == 'R':
		x += 1
y = 0
if x != 0:
	for j in range(x):
		if c[j] == 'W':
			y += 1
print(y)


n = int(input())
c = str(input())
x = c.count('R')
y = c.count('R', 0, x)
print(x - y)


n = int(input())
c = input()
thresh = c.count('R')
r = c[:thresh].count('W')
print(r)


N = int(input())
s = input()
r = s.count('R')
print(s[:r].count('W'))


def main():
	n = int(input())
	C = input()
	rc = C.count('R')
	rhc = C[:rc].count('R')
	print(rc - rhc)

def __starting_point():
	main()
__starting_point()


N = int(input())
c = input()
r = c.count('R')
cc = c[0:r]
print(cc.count('W'))


def solve(string):
	(n, c) = string.split()
	(n, c) = (int(n), list(c))
	(wi, ri) = (0, n - 1)
	while wi < n and c[wi] == 'R':
		wi += 1
	while ri >= 0 and c[ri] == 'W':
		ri -= 1
	ans = 0
	while wi < n and ri >= 0 and (wi < ri):
		(c[wi], c[ri], ans) = (c[ri], c[wi], ans + 1)
		(wi, ri) = (wi + 1, ri - 1)
		while wi < n and c[wi] == 'R':
			wi += 1
		while ri >= 0 and c[ri] == 'W':
			ri -= 1
	return str(ans)

def __starting_point():
	import sys
	print(solve(sys.stdin.read().strip()))
__starting_point()


N = int(input())
C = input()
print(C.count('R') - C.count('R', 0, C.count('R')))


N = int(input())
S = list(input())
cnt = S.count('R')
ans = S[cnt:].count('R')
print(ans)


n = int(input())
c = input()
rcount = c.count('R')
print(rcount - c[:rcount].count('R'))


N = int(input())
S = input()
le = S.count('R')
P = S[le:]
print(P.count('R'))


n = int(input())
s = input()
rcnt = s.count('R')
num = s[0:rcnt]
rnum = num.count('R')
print(rcnt - rnum)


N = int(input())
C = input()
n = 0
c = 0
for i in range(N)[::-1]:
	if C[i] == 'R':
		while n < i:
			if C[n] == 'W':
				c += 1
				n += 1
				break
			n += 1
print(c)


n = int(input())
s = input()
nr = s.count('R')
print(s[:nr].count('W'))


N = int(input())
C = input()
w = C.count('W')
print(w - C[N - w:].count('W'))


import collections

def main():
	n = int(input())
	s = input()
	a_list = []
	for i in range(n):
		if s[i] == 'W':
			a_list.append(0)
		else:
			a_list.append(1)
	r_count = sum(a_list)
	print(r_count - sum(a_list[0:r_count]))

def input_list():
	return list(map(int, input().split()))

def input_list_str():
	return list(map(str, input().split()))

def __starting_point():
	main()
__starting_point()


n = int(input())
C = input()
rc = C.count('R')
x = C.count('R', 0, rc)
print(rc - x)


n = int(input())
c = input()
a = c.count('R')
cnt = 0
for i in range(a):
	if c[i] == 'W':
		cnt += 1
print(cnt)


n = int(input())
s = input()
num = s.count('R')
L = s[:num]
ans = L.count('W')
print(ans)


N = int(input())
C = input()
R_cnt = C.count('R')
print(C[:R_cnt].count('W'))


import sys
read = sys.stdin.read

def main():
	n = int(input())
	rc = tuple(input())
	rc2 = [c == 'W' for c in rc]
	r1 = sum(rc2)
	r2 = n - r1
	r3 = sum(rc2[:r2])
	print(min(r1, r2, r3))

def __starting_point():
	main()
__starting_point()


n = int(input())
c = input()
c1 = c.count('R')
c2 = c[:c1].count('W')
print(c2)


_ = input()
(*C,) = input()
print(len(['' for _ in range(C.count('W')) if C and C.pop() == 'R']))


N = int(input())
S = input()
print(S[S.count('R'):].count('R'))


n = int(input())
c = input()
red = c.count('R')
print(c[:red].count('W'))


import sys
N = int(input())
S = input()
print(S[S.count('R'):len(S)].count('R'))


N = int(input())
c = input()
num_R = c.count('R')
print(c[:num_R].count('W'))


n = int(input())
c = list(input())
x = c.count('R')
m = c[:x]
y = m.count('W')
print(y)


n = int(input())
s = input()
Ra = s.count('R')
t = s[:Ra]
Rb = t.count('R')
print(Ra - Rb)


N = int(input())
C = list(input())
count = list()
W = 0
R = 0
for i in C:
	if i == 'R':
		R += 1
if R == 0:
	count.append(0)
for i in C:
	if i == 'W':
		W += 1
	else:
		R -= 1
	if W <= R:
		count.append(R)
	else:
		count.append(W)
print(min(count))


a = int(input())
v = input()
b = v.count('R')
c = 0
for i in v[:b]:
	if i != 'R':
		c += 1
print(c)


N = int(input())
C = input()
x = C.count('R')
C = C[:x]
x2 = C.count('R')
print(x - x2)


import sys
from collections import Counter
input = sys.stdin.readline
N = int(input())
C = list(input().strip())
counter = Counter(C)
if len(counter) == 1:
	print(0)
else:
	red_n = counter['R']
	ans = 0
	for i in range(N):
		if red_n <= i:
			break
		if C[i] == 'W':
			ans += 1
	print(ans)


N = int(input())
S = input()
Answer = 0
White = 0
Red = S.count('R')
for j in range(len(S)):
	i = S[j]
	if i == 'W':
		White += 1
	elif i == 'R' and White > 0 and (j + 1 > Red):
		Answer += 1
		White -= 1
print(Answer)


N = int(input())
c = input()
x = c.count('R')
print(c[x:].count('R'))


N = int(input())
c = input()
r_cnt = c.count('R')
print(c[:r_cnt].count('W'))


N = int(input())
C = str(input())
white = C.count('W')
Ccut = C[N - white:]
print(Ccut.count('R'))


N = int(input())
C = list(input())
Rnum = C.count('R')
print(C[:Rnum].count('W'))


num = int(input())
c_i = input()
r_Count = c_i.count('R')
print(c_i[:r_Count].count('W'))


N = int(input())
C = list(input())
R_count = C.count('R')
if R_count == 0:
	print(0)
	return
C_count = C[:R_count].count('R')
print(R_count - C_count)


n = int(input())
c = str(input())
a = c.count('R')
b = c[:a].count('R')
print(a - b)


N = int(input())
c = input()
Rn = c.count('R')
c2 = c[:Rn]
res = c2.count('W')
print(res)


n = int(input())
c = input()
dv = c.count('R')
print(c[:dv].count('W'))