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