from collections import Counter

n = int(input())
c = list(input())
count = Counter(c)
ans = float('inf')
w = 0
r = 0

if count.get('R'):
    r = count['R']

ans = max(w, r)

for i in range(n):
    if c[i]=='W':
        w += 1
    else:
        r -= 1
    ans =min(max(w,r), ans)
print(ans) from collections import Counter n = int(input()) n int(input()) int input() input c = list(input()) c list(input()) list input() input count = Counter(c) count Counter(c) Counter c ans = float('inf') ans float('inf') float 'inf' w = 0 w 0 r = 0 r 0 if count.get('R'):
    r = count['R'] count.get('R') count.get count get 'R' r = count['R'] r count['R'] count 'R' ans = max(w, r) ans max(w, r) max w r for i in range(n):
    if c[i]=='W':
        w += 1
    else:
        r -= 1
    ans =min(max(w,r), ans) i range(n) range n if c[i]=='W':
        w += 1
    else:
        r -= 1
     c[i]=='W' c[i] c i 'W' w += 1 w 1 r -= 1 r 1 ans =min(max(w,r), ans) ans min(max(w,r), ans) min max(w,r) max w r ans print(ans) print ans r = count['R'] count['R'] r r = 0 0 r w += 1 1 w r -= 1 1 r ans =min(max(w,r), ans) min(max(w,r), ans) ans c = list(input()) list(input()) c ans = float('inf') float('inf') ans ans = max(w, r) max(w, r) ans n = int(input()) int(input()) n count = Counter(c) Counter(c) count w = 0 0 w
from collections import Counter

n = int(input())
c = list(input())
count = Counter(c)
ans = float('inf')
w = 0
r = 0

if count.get('R'):
    r = count['R']

ans = max(w, r)

for i in range(n):
    if c[i]=='W':
        w += 1
    else:
        r -= 1
    ans =min(max(w,r), ans)
print(ans)