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

rw = [0, 0]
for i in range(N):
  if c[i] == 'R':
    rw[0] += 1
  else:
    rw[1] += 1
    
ans = N
left_rw = [0, 0]
right_rw = rw[:]
for i in range(N+1):
  if i == 0:
    pass
  else:
    if c[i-1] == 'R':
      left_rw[0] += 1
      right_rw[0] -= 1
    else:
      left_rw[1] += 1
      right_rw[1] -= 1
      
  ans = min(max(left_rw[1], right_rw[0]), ans)
  
print(ans) N = int(input()) N int(input()) int input() input c = input() c input() input rw = [0, 0] rw [0, 0] 0 0 for i in range(N):
  if c[i] == 'R':
    rw[0] += 1
  else:
    rw[1] += 1
     i range(N) range N if c[i] == 'R':
    rw[0] += 1
  else:
    rw[1] += 1
     c[i] == 'R' c[i] c i 'R' rw[0] += 1 rw[0] rw 0 1 rw[1] += 1 rw[1] rw 1 1 ans = N ans N left_rw = [0, 0] left_rw [0, 0] 0 0 right_rw = rw[:] right_rw rw[:] rw : for i in range(N+1):
  if i == 0:
    pass
  else:
    if c[i-1] == 'R':
      left_rw[0] += 1
      right_rw[0] -= 1
    else:
      left_rw[1] += 1
      right_rw[1] -= 1
      
  ans = min(max(left_rw[1], right_rw[0]), ans)
   i range(N+1) range N+1 N 1 if i == 0:
    pass
  else:
    if c[i-1] == 'R':
      left_rw[0] += 1
      right_rw[0] -= 1
    else:
      left_rw[1] += 1
      right_rw[1] -= 1
      
   i == 0 i 0 if c[i-1] == 'R':
      left_rw[0] += 1
      right_rw[0] -= 1
    else:
      left_rw[1] += 1
      right_rw[1] -= 1
      
   c[i-1] == 'R' c[i-1] c i-1 i 1 'R' left_rw[0] += 1 left_rw[0] left_rw 0 1 right_rw[0] -= 1 right_rw[0] right_rw 0 1 left_rw[1] += 1 left_rw[1] left_rw 1 1 right_rw[1] -= 1 right_rw[1] right_rw 1 1 ans = min(max(left_rw[1], right_rw[0]), ans) ans min(max(left_rw[1], right_rw[0]), ans) min max(left_rw[1], right_rw[0]) max left_rw[1] left_rw 1 right_rw[0] right_rw 0 ans print(ans) print ans N = int(input()) int(input()) N left_rw = [0, 0] [0, 0] left_rw ans = N N ans rw = [0, 0] [0, 0] rw c = input() input() c ans = min(max(left_rw[1], right_rw[0]), ans) min(max(left_rw[1], right_rw[0]), ans) ans right_rw = rw[:] rw[:] right_rw
N = int(input())
c = input()

rw = [0, 0]
for i in range(N):
  if c[i] == 'R':
    rw[0] += 1
  else:
    rw[1] += 1
    
ans = N
left_rw = [0, 0]
right_rw = rw[:]
for i in range(N+1):
  if i == 0:
    pass
  else:
    if c[i-1] == 'R':
      left_rw[0] += 1
      right_rw[0] -= 1
    else:
      left_rw[1] += 1
      right_rw[1] -= 1
      
  ans = min(max(left_rw[1], right_rw[0]), ans)
  
print(ans)