# -*- coding: utf-8 -*-

N = int(input())
c = input()

r_total = 0
w_total = 0
for i in c:
  if i == 'R':
    r_total += 1
  elif i == 'W':
    w_total += 1

w_left = 0
r_left = 0

ans = r_total # 仕切りが左端の場合

# iが仕切りの位置
for i in range(N):
  cnt = 0
  if c[i] == 'R':
    r_left += 1
    
  elif c[i] == 'W':
    w_left += 1
    
  if w_left <= r_total - r_left:
    cnt += w_left # 仕切りより左の白と右の赤を入れ替え
    cnt += (r_total - r_left) - w_left # 仕切りより右の赤を白に変更
  else:
    cnt += r_total - r_left  # 仕切りより左の白と右の赤を入れ替え
    cnt += w_left - (r_total - r_left) # 仕切りより左の白を赤に変更
  ans = min(ans, cnt)
print(ans) N = int(input()) N int(input()) int input() input c = input() c input() input r_total = 0 r_total 0 w_total = 0 w_total 0 for i in c:
  if i == 'R':
    r_total += 1
  elif i == 'W':
    w_total += 1 i c if i == 'R':
    r_total += 1
  elif i == 'W':
    w_total += 1 i == 'R' i 'R' r_total += 1 r_total 1 elif i == 'W':
    w_total += 1 i == 'W' i 'W' w_total += 1 w_total 1 w_left = 0 w_left 0 r_left = 0 r_left 0 ans = r_total ans r_total for i in range(N):
  cnt = 0
  if c[i] == 'R':
    r_left += 1
    
  elif c[i] == 'W':
    w_left += 1
    
  if w_left <= r_total - r_left:
    cnt += w_left # 仕切りより左の白と右の赤を入れ替え
    cnt += (r_total - r_left) - w_left # 仕切りより右の赤を白に変更
  else:
    cnt += r_total - r_left  # 仕切りより左の白と右の赤を入れ替え
    cnt += w_left - (r_total - r_left) # 仕切りより左の白を赤に変更
  ans = min(ans, cnt) i range(N) range N cnt = 0 cnt 0 if c[i] == 'R':
    r_left += 1
    
  elif c[i] == 'W':
    w_left += 1
    
   c[i] == 'R' c[i] c i 'R' r_left += 1 r_left 1 elif c[i] == 'W':
    w_left += 1
    
   c[i] == 'W' c[i] c i 'W' w_left += 1 w_left 1 if w_left <= r_total - r_left:
    cnt += w_left # 仕切りより左の白と右の赤を入れ替え
    cnt += (r_total - r_left) - w_left # 仕切りより右の赤を白に変更
  else:
    cnt += r_total - r_left  # 仕切りより左の白と右の赤を入れ替え
    cnt += w_left - (r_total - r_left) # 仕切りより左の白を赤に変更
   w_left <= r_total - r_left w_left r_total - r_left r_total r_left cnt += w_left cnt w_left cnt += (r_total - r_left) - w_left cnt (r_total - r_left) - w_left r_total - r_left r_total r_left w_left cnt += r_total - r_left cnt r_total - r_left r_total r_left cnt += w_left - (r_total - r_left) cnt w_left - (r_total - r_left) w_left r_total - r_left r_total r_left ans = min(ans, cnt) ans min(ans, cnt) min ans cnt print(ans) print ans w_total = 0 0 w_total ans = min(ans, cnt) min(ans, cnt) ans w_left = 0 0 w_left w_total += 1 1 w_total cnt += r_total - r_left r_total - r_left cnt cnt = 0 0 cnt cnt += w_left w_left cnt c = input() input() c cnt += w_left - (r_total - r_left) w_left - (r_total - r_left) cnt r_total = 0 0 r_total r_left = 0 0 r_left w_left += 1 1 w_left cnt += (r_total - r_left) - w_left (r_total - r_left) - w_left cnt N = int(input()) int(input()) N r_left += 1 1 r_left ans = r_total r_total ans r_total += 1 1 r_total
# -*- coding: utf-8 -*-

N = int(input())
c = input()

r_total = 0
w_total = 0
for i in c:
  if i == 'R':
    r_total += 1
  elif i == 'W':
    w_total += 1

w_left = 0
r_left = 0

ans = r_total # 仕切りが左端の場合

# iが仕切りの位置
for i in range(N):
  cnt = 0
  if c[i] == 'R':
    r_left += 1
    
  elif c[i] == 'W':
    w_left += 1
    
  if w_left <= r_total - r_left:
    cnt += w_left # 仕切りより左の白と右の赤を入れ替え
    cnt += (r_total - r_left) - w_left # 仕切りより右の赤を白に変更
  else:
    cnt += r_total - r_left  # 仕切りより左の白と右の赤を入れ替え
    cnt += w_left - (r_total - r_left) # 仕切りより左の白を赤に変更
  ans = min(ans, cnt)
print(ans)