def solve():
    N = int(input())
    C = list(input())

    right = N-1
    left = 0

    cnt = 0
    while left < right:
        while left < N and C[left] == 'R':
            left += 1

        while right >= 0 and C[right] == 'W':
            right -= 1
        
        if left >= right:
            break
        
        C[left], C[right] = C[right], C[left]
        cnt += 1
    
    print(min(cnt,C.count("R"), C.count("W")))
    
if __name__ == '__main__':
    solve() def solve():
    N = int(input())
    C = list(input())

    right = N-1
    left = 0

    cnt = 0
    while left < right:
        while left < N and C[left] == 'R':
            left += 1

        while right >= 0 and C[right] == 'W':
            right -= 1
        
        if left >= right:
            break
        
        C[left], C[right] = C[right], C[left]
        cnt += 1
    
    print(min(cnt,C.count("R"), C.count("W")))
     solve N = int(input()) N int(input()) int input() input C = list(input()) C list(input()) list input() input right = N-1 right N-1 N 1 left = 0 left 0 cnt = 0 cnt 0 while left < right:
        while left < N and C[left] == 'R':
            left += 1

        while right >= 0 and C[right] == 'W':
            right -= 1
        
        if left >= right:
            break
        
        C[left], C[right] = C[right], C[left]
        cnt += 1
    
     left < right left right while left < N and C[left] == 'R':
            left += 1

         left < N and C[left] == 'R' left < N left N C[left] == 'R' C[left] C left 'R' left += 1 left 1 while right >= 0 and C[right] == 'W':
            right -= 1
        
         right >= 0 and C[right] == 'W' right >= 0 right 0 C[right] == 'W' C[right] C right 'W' right -= 1 right 1 if left >= right:
            break
        
         left >= right left right break C[left], C[right] = C[right], C[left] C[left] C left C[right] C right C[right] C right C[left] C left cnt += 1 cnt 1 print(min(cnt,C.count("R"), C.count("W"))) print min(cnt,C.count("R"), C.count("W")) min cnt C.count("R") C.count C count "R" C.count("W") C.count C count "W" if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve def solve():
    N = int(input())
    C = list(input())

    right = N-1
    left = 0

    cnt = 0
    while left < right:
        while left < N and C[left] == 'R':
            left += 1

        while right >= 0 and C[right] == 'W':
            right -= 1
        
        if left >= right:
            break
        
        C[left], C[right] = C[right], C[left]
        cnt += 1
    
    print(min(cnt,C.count("R"), C.count("W")))
     def solve():
    N = int(input())
    C = list(input())

    right = N-1
    left = 0

    cnt = 0
    while left < right:
        while left < N and C[left] == 'R':
            left += 1

        while right >= 0 and C[right] == 'W':
            right -= 1
        
        if left >= right:
            break
        
        C[left], C[right] = C[right], C[left]
        cnt += 1
    
    print(min(cnt,C.count("R"), C.count("W")))
     solve
def solve():
    N = int(input())
    C = list(input())

    right = N-1
    left = 0

    cnt = 0
    while left < right:
        while left < N and C[left] == 'R':
            left += 1

        while right >= 0 and C[right] == 'W':
            right -= 1
        
        if left >= right:
            break
        
        C[left], C[right] = C[right], C[left]
        cnt += 1
    
    print(min(cnt,C.count("R"), C.count("W")))
    
if __name__ == '__main__':
    solve()