import sys

from collections import deque

import numpy as np

import math

sys.setrecursionlimit(10**6)

def S(): return sys.stdin.readline().rstrip()

def SL(): return list(map(str,sys.stdin.readline().rstrip().split()))

def I(): return int(sys.stdin.readline().rstrip())

def IL(): return list(map(int,sys.stdin.readline().rstrip().split()))



if __name__=='__main__':

    n = I()

    c = list(S())

    i,j = 0,n-1

    ans = 0

    while i<j:

        while c[i]=='R':

            i += 1

            if i==n-1:

                break

        while c[j]=='W':

            j -= 1

            if j==0:

                break

        if i<j:

            c[i],c[j] = c[j],c[i]

            i += 1

            j -= 1

            ans += 1

    print(ans)

    exit()
import sys

def S(): return sys.stdin.readline().rstrip()

def I(): return int(sys.stdin.readline().rstrip())



if __name__=='__main__':

    n = I()

    c = list(S())

    i,j = 0,n-1

    ans = 0

    while i<j:

        while c[i]=='R':

            i += 1

            if i==n:

                break

        while c[j]=='W':

            j -= 1

            if j==-1:

                break

        if i<j:

            c[i],c[j] = c[j],c[i]

            i += 1

            j -= 1

            ans += 1

    print(ans)

    exit()
import sys
from collections import deque
import numpy as np
import math

sys.setrecursionlimit(10**6)


def S():
    return sys.stdin.readline().rstrip()


def SL():
    return list(map(str, sys.stdin.readline().rstrip().split()))


def I():
    return int(sys.stdin.readline().rstrip())


def IL():
    return list(map(int, sys.stdin.readline().rstrip().split()))


if __name__ == "__main__":
    n = I()
    c = list(S())
    i, j = 0, n - 1
    ans = 0
    while i < j:
        while c[i] == "R":
            i += 1
            if i == n - 1:
                break
        while c[j] == "W":
            j -= 1
            if j == 0:
                break
        if i < j:
            c[i], c[j] = c[j], c[i]
            i += 1
            j -= 1
            ans += 1
    print(ans)
    exit()

import sys


def S():
    return sys.stdin.readline().rstrip()


def I():
    return int(sys.stdin.readline().rstrip())


if __name__ == "__main__":
    n = I()
    c = list(S())
    i, j = 0, n - 1
    ans = 0
    while i < j:
        while c[i] == "R":
            i += 1
            if i == n:
                break
        while c[j] == "W":
            j -= 1
            if j == -1:
                break
        if i < j:
            c[i], c[j] = c[j], c[i]
            i += 1
            j -= 1
            ans += 1
    print(ans)
    exit()

-from collections import deque -import numpy as np -import math - -sys.setrecursionlimit(10**6) -def SL(): -    return list(map(str, sys.stdin.readline().rstrip().split())) - - - - -def IL(): -    return list(map(int, sys.stdin.readline().rstrip().split())) -            if i == n - 1: +            if i == n: -            if j == 0: +            if j == -1: