from sys import stdin

input = stdin.readline
import math

def solve():
    n = int(input())
    a = list(input().strip())
    left = 0
    rpos = [i for i in range(n) if a[i] == 'R']
    if not rpos:
        print(0)
        return
    right = len(rpos) - 1
    cnt = 0
    while right >= 0 and left < rpos[right]:
        if a[left] == 'W':
            cnt += 1
            right -= 1
        left += 1
    print(cnt)

if __name__ == '__main__':
    solve() from sys import stdin input = stdin.readline input stdin.readline stdin readline import math math def solve():
    n = int(input())
    a = list(input().strip())
    left = 0
    rpos = [i for i in range(n) if a[i] == 'R']
    if not rpos:
        print(0)
        return
    right = len(rpos) - 1
    cnt = 0
    while right >= 0 and left < rpos[right]:
        if a[left] == 'W':
            cnt += 1
            right -= 1
        left += 1
    print(cnt) solve n = int(input()) n int(input()) int input() input a = list(input().strip()) a list(input().strip()) list input().strip() ().strip () input strip left = 0 left 0 i for i in range(n) if a[i] == 'R' for i in range(n) if a[i] == 'R' i range(n) range n a[i] == 'R' a[i] a i 'R' if a[i] == 'R' i rpos = [i for i in range(n) if a[i] == 'R'] rpos [i for i in range(n) if a[i] == 'R'] if not rpos:
        print(0)
        return
     not rpos rpos print(0) print 0 return right = len(rpos) - 1 right len(rpos) - 1 len(rpos) len rpos 1 cnt = 0 cnt 0 while right >= 0 and left < rpos[right]:
        if a[left] == 'W':
            cnt += 1
            right -= 1
        left += 1
     right >= 0 and left < rpos[right] right >= 0 right 0 left < rpos[right] left rpos[right] rpos right if a[left] == 'W':
            cnt += 1
            right -= 1
         a[left] == 'W' a[left] a left 'W' cnt += 1 cnt 1 right -= 1 right 1 left += 1 left 1 print(cnt) print cnt if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve input = stdin.readline stdin.readline input def solve():
    n = int(input())
    a = list(input().strip())
    left = 0
    rpos = [i for i in range(n) if a[i] == 'R']
    if not rpos:
        print(0)
        return
    right = len(rpos) - 1
    cnt = 0
    while right >= 0 and left < rpos[right]:
        if a[left] == 'W':
            cnt += 1
            right -= 1
        left += 1
    print(cnt) def solve():
    n = int(input())
    a = list(input().strip())
    left = 0
    rpos = [i for i in range(n) if a[i] == 'R']
    if not rpos:
        print(0)
        return
    right = len(rpos) - 1
    cnt = 0
    while right >= 0 and left < rpos[right]:
        if a[left] == 'W':
            cnt += 1
            right -= 1
        left += 1
    print(cnt) solve
from sys import stdin

input = stdin.readline
import math

def solve():
    n = int(input())
    a = list(input().strip())
    left = 0
    rpos = [i for i in range(n) if a[i] == 'R']
    if not rpos:
        print(0)
        return
    right = len(rpos) - 1
    cnt = 0
    while right >= 0 and left < rpos[right]:
        if a[left] == 'W':
            cnt += 1
            right -= 1
        left += 1
    print(cnt)

if __name__ == '__main__':
    solve()
