import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    chars = readline().decode()

    cntW = [0]
    cntR = [0] 
    for i in range(N):
        cntW.append(cntW[i] + (1 if chars[i] == 'W' else 0))
        cntR.append(cntR[i] + (1 if chars[i] == 'R' else 0))

    ans = int(1e9)
    for i in range(N+1):
        leftW = cntW[i]
        rightR = cntR[N]-cntR[i] 

        if leftW <= rightR:
            tmp = leftW + (rightR - leftW)
        else:
            tmp = rightR + (leftW - rightR)
        ans = min(tmp, ans)
    print(ans)
if __name__ == '__main__':
    main() import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines def main():
    N = int(readline())
    chars = readline().decode()

    cntW = [0]
    cntR = [0] 
    for i in range(N):
        cntW.append(cntW[i] + (1 if chars[i] == 'W' else 0))
        cntR.append(cntR[i] + (1 if chars[i] == 'R' else 0))

    ans = int(1e9)
    for i in range(N+1):
        leftW = cntW[i]
        rightR = cntR[N]-cntR[i] 

        if leftW <= rightR:
            tmp = leftW + (rightR - leftW)
        else:
            tmp = rightR + (leftW - rightR)
        ans = min(tmp, ans)
    print(ans) main N = int(readline()) N int(readline()) int readline() readline chars = readline().decode() chars readline().decode() ().decode () readline decode cntW = [0] cntW [0] 0 cntR = [0] cntR [0] 0 for i in range(N):
        cntW.append(cntW[i] + (1 if chars[i] == 'W' else 0))
        cntR.append(cntR[i] + (1 if chars[i] == 'R' else 0))

     i range(N) range N cntW.append(cntW[i] + (1 if chars[i] == 'W' else 0)) cntW.append cntW append cntW[i] + (1 if chars[i] == 'W' else 0) cntW[i] cntW i 1 if chars[i] == 'W' else 0 chars[i] == 'W' chars[i] chars i 'W' 1 0 cntR.append(cntR[i] + (1 if chars[i] == 'R' else 0)) cntR.append cntR append cntR[i] + (1 if chars[i] == 'R' else 0) cntR[i] cntR i 1 if chars[i] == 'R' else 0 chars[i] == 'R' chars[i] chars i 'R' 1 0 ans = int(1e9) ans int(1e9) int 1e9 for i in range(N+1):
        leftW = cntW[i]
        rightR = cntR[N]-cntR[i] 

        if leftW <= rightR:
            tmp = leftW + (rightR - leftW)
        else:
            tmp = rightR + (leftW - rightR)
        ans = min(tmp, ans)
     i range(N+1) range N+1 N 1 leftW = cntW[i] leftW cntW[i] cntW i rightR = cntR[N]-cntR[i] rightR cntR[N]-cntR[i] cntR[N] cntR N cntR[i] cntR i if leftW <= rightR:
            tmp = leftW + (rightR - leftW)
        else:
            tmp = rightR + (leftW - rightR)
         leftW <= rightR leftW rightR tmp = leftW + (rightR - leftW) tmp leftW + (rightR - leftW) leftW rightR - leftW rightR leftW tmp = rightR + (leftW - rightR) tmp rightR + (leftW - rightR) rightR leftW - rightR leftW rightR ans = min(tmp, ans) ans min(tmp, ans) min tmp ans print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline read = sys.stdin.buffer.read sys.stdin.buffer.read read readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines def main():
    N = int(readline())
    chars = readline().decode()

    cntW = [0]
    cntR = [0] 
    for i in range(N):
        cntW.append(cntW[i] + (1 if chars[i] == 'W' else 0))
        cntR.append(cntR[i] + (1 if chars[i] == 'R' else 0))

    ans = int(1e9)
    for i in range(N+1):
        leftW = cntW[i]
        rightR = cntR[N]-cntR[i] 

        if leftW <= rightR:
            tmp = leftW + (rightR - leftW)
        else:
            tmp = rightR + (leftW - rightR)
        ans = min(tmp, ans)
    print(ans) def main():
    N = int(readline())
    chars = readline().decode()

    cntW = [0]
    cntR = [0] 
    for i in range(N):
        cntW.append(cntW[i] + (1 if chars[i] == 'W' else 0))
        cntR.append(cntR[i] + (1 if chars[i] == 'R' else 0))

    ans = int(1e9)
    for i in range(N+1):
        leftW = cntW[i]
        rightR = cntR[N]-cntR[i] 

        if leftW <= rightR:
            tmp = leftW + (rightR - leftW)
        else:
            tmp = rightR + (leftW - rightR)
        ans = min(tmp, ans)
    print(ans) main
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    chars = readline().decode()

    cntW = [0]
    cntR = [0] 
    for i in range(N):
        cntW.append(cntW[i] + (1 if chars[i] == 'W' else 0))
        cntR.append(cntR[i] + (1 if chars[i] == 'R' else 0))

    ans = int(1e9)
    for i in range(N+1):
        leftW = cntW[i]
        rightR = cntR[N]-cntR[i] 

        if leftW <= rightR:
            tmp = leftW + (rightR - leftW)
        else:
            tmp = rightR + (leftW - rightR)
        ans = min(tmp, ans)
    print(ans)
if __name__ == '__main__':
    main()
