n = int(input())
s = list(input().rstrip())

left_cur = 0
right_cur = n - 1
ans = 0
flag = False
while(left_cur < right_cur and left_cur < n - 1 and right_cur > 0):
    while(s[left_cur] == 'R'):
        left_cur += 1
        if (left_cur == n - 1):
            flag = True
            break
    while(s[right_cur] == 'W'):
        right_cur -= 1
        if (right_cur == 0):
            flag = True
            break
    if(left_cur > right_cur):
        flag = True
    if(flag):
        break
    ans += 1
    left_cur += 1
    right_cur -= 1

print(ans) n = int(input()) n int(input()) int input() input s = list(input().rstrip()) s list(input().rstrip()) list input().rstrip() ().rstrip () input rstrip left_cur = 0 left_cur 0 right_cur = n - 1 right_cur n - 1 n 1 ans = 0 ans 0 flag = False flag False while(left_cur < right_cur and left_cur < n - 1 and right_cur > 0):
    while(s[left_cur] == 'R'):
        left_cur += 1
        if (left_cur == n - 1):
            flag = True
            break
    while(s[right_cur] == 'W'):
        right_cur -= 1
        if (right_cur == 0):
            flag = True
            break
    if(left_cur > right_cur):
        flag = True
    if(flag):
        break
    ans += 1
    left_cur += 1
    right_cur -= 1 left_cur < right_cur and left_cur < n - 1 and right_cur > 0 left_cur < right_cur and left_cur < n - 1 left_cur < right_cur left_cur right_cur left_cur < n - 1 left_cur n - 1 n 1 right_cur > 0 right_cur 0 while(s[left_cur] == 'R'):
        left_cur += 1
        if (left_cur == n - 1):
            flag = True
            break
     s[left_cur] == 'R' s[left_cur] s left_cur 'R' left_cur += 1 left_cur 1 if (left_cur == n - 1):
            flag = True
            break
     left_cur == n - 1 left_cur n - 1 n 1 flag = True flag True break while(s[right_cur] == 'W'):
        right_cur -= 1
        if (right_cur == 0):
            flag = True
            break
     s[right_cur] == 'W' s[right_cur] s right_cur 'W' right_cur -= 1 right_cur 1 if (right_cur == 0):
            flag = True
            break
     right_cur == 0 right_cur 0 flag = True flag True break if(left_cur > right_cur):
        flag = True
     left_cur > right_cur left_cur right_cur flag = True flag True if(flag):
        break
     flag break ans += 1 ans 1 left_cur += 1 left_cur 1 right_cur -= 1 right_cur 1 print(ans) print ans right_cur -= 1 1 right_cur right_cur -= 1 1 right_cur n = int(input()) int(input()) n ans = 0 0 ans left_cur += 1 1 left_cur flag = True True flag left_cur += 1 1 left_cur s = list(input().rstrip()) list(input().rstrip()) s flag = False False flag right_cur = n - 1 n - 1 right_cur flag = True True flag left_cur = 0 0 left_cur flag = True True flag ans += 1 1 ans
n = int(input())
s = list(input().rstrip())

left_cur = 0
right_cur = n - 1
ans = 0
flag = False
while(left_cur < right_cur and left_cur < n - 1 and right_cur > 0):
    while(s[left_cur] == 'R'):
        left_cur += 1
        if (left_cur == n - 1):
            flag = True
            break
    while(s[right_cur] == 'W'):
        right_cur -= 1
        if (right_cur == 0):
            flag = True
            break
    if(left_cur > right_cur):
        flag = True
    if(flag):
        break
    ans += 1
    left_cur += 1
    right_cur -= 1

print(ans)
