N = int(input())
c = list(input())
cd = c[::-1]

rs = [0]*(N+1)
ws = [0]*(N+1)
ws[0]= 0
rs[0] = 0

for i in range(N):
    if(c[i]=="W"):
        rs[i+1]=rs[i]+1
    else:
        rs[i+1]=rs[i]

    if(cd[i]=="R"):
        ws[i+1]=ws[i]+1
    else:
        ws[i+1]=ws[i]
    
ws.reverse()

m = 1000000000
for i in range(N+1):
    M = max(rs[i],ws[i])
    if m>M:
        m = M
    
print(m) N = int(input()) N int(input()) int input() input c = list(input()) c list(input()) list input() input cd = c[::-1] cd c[::-1] c ::-1 -1 rs = [0]*(N+1) rs [0]*(N+1) [0] 0 N+1 N 1 ws = [0]*(N+1) ws [0]*(N+1) [0] 0 N+1 N 1 ws[0]= 0 ws[0] ws 0 0 rs[0] = 0 rs[0] rs 0 0 for i in range(N):
    if(c[i]=="W"):
        rs[i+1]=rs[i]+1
    else:
        rs[i+1]=rs[i]

    if(cd[i]=="R"):
        ws[i+1]=ws[i]+1
    else:
        ws[i+1]=ws[i]
     i range(N) range N if(c[i]=="W"):
        rs[i+1]=rs[i]+1
    else:
        rs[i+1]=rs[i]

     c[i]=="W" c[i] c i "W" rs[i+1]=rs[i]+1 rs[i+1] rs i+1 i 1 rs[i]+1 rs[i] rs i 1 rs[i+1]=rs[i] rs[i+1] rs i+1 i 1 rs[i] rs i if(cd[i]=="R"):
        ws[i+1]=ws[i]+1
    else:
        ws[i+1]=ws[i]
     cd[i]=="R" cd[i] cd i "R" ws[i+1]=ws[i]+1 ws[i+1] ws i+1 i 1 ws[i]+1 ws[i] ws i 1 ws[i+1]=ws[i] ws[i+1] ws i+1 i 1 ws[i] ws i ws.reverse() ws.reverse ws reverse m = 1000000000 m 1000000000 for i in range(N+1):
    M = max(rs[i],ws[i])
    if m>M:
        m = M
     i range(N+1) range N+1 N 1 M = max(rs[i],ws[i]) M max(rs[i],ws[i]) max rs[i] rs i ws[i] ws i if m>M:
        m = M
     m>M m M m = M m M print(m) print m c = list(input()) list(input()) c m = M M m rs = [0]*(N+1) [0]*(N+1) rs m = 1000000000 1000000000 m cd = c[::-1] c[::-1] cd N = int(input()) int(input()) N ws = [0]*(N+1) [0]*(N+1) ws M = max(rs[i],ws[i]) max(rs[i],ws[i]) M
N = int(input())
c = list(input())
cd = c[::-1]

rs = [0]*(N+1)
ws = [0]*(N+1)
ws[0]= 0
rs[0] = 0

for i in range(N):
    if(c[i]=="W"):
        rs[i+1]=rs[i]+1
    else:
        rs[i+1]=rs[i]

    if(cd[i]=="R"):
        ws[i+1]=ws[i]+1
    else:
        ws[i+1]=ws[i]
    
ws.reverse()

m = 1000000000
for i in range(N+1):
    M = max(rs[i],ws[i])
    if m>M:
        m = M
    
print(m)
