def abc174d():
    n = int(input())
    s = input()
    cnt = s.count('R')
    if cnt == len(s):
        print(0)
        return
    start = 0
    while s[start] == 'R':
        start += 1
        cnt -= 1
    ans = cnt
    for i in range(start, start+cnt):
        if s[i] == 'R':
            ans -= 1
    print(ans)
abc174d() def abc174d():
    n = int(input())
    s = input()
    cnt = s.count('R')
    if cnt == len(s):
        print(0)
        return
    start = 0
    while s[start] == 'R':
        start += 1
        cnt -= 1
    ans = cnt
    for i in range(start, start+cnt):
        if s[i] == 'R':
            ans -= 1
    print(ans) abc174d n = int(input()) n int(input()) int input() input s = input() s input() input cnt = s.count('R') cnt s.count('R') s.count s count 'R' if cnt == len(s):
        print(0)
        return
     cnt == len(s) cnt len(s) len s print(0) print 0 return start = 0 start 0 while s[start] == 'R':
        start += 1
        cnt -= 1
     s[start] == 'R' s[start] s start 'R' start += 1 start 1 cnt -= 1 cnt 1 ans = cnt ans cnt for i in range(start, start+cnt):
        if s[i] == 'R':
            ans -= 1
     i range(start, start+cnt) range start start+cnt start cnt if s[i] == 'R':
            ans -= 1
     s[i] == 'R' s[i] s i 'R' ans -= 1 ans 1 print(ans) print ans abc174d() abc174d def abc174d():
    n = int(input())
    s = input()
    cnt = s.count('R')
    if cnt == len(s):
        print(0)
        return
    start = 0
    while s[start] == 'R':
        start += 1
        cnt -= 1
    ans = cnt
    for i in range(start, start+cnt):
        if s[i] == 'R':
            ans -= 1
    print(ans) def abc174d():
    n = int(input())
    s = input()
    cnt = s.count('R')
    if cnt == len(s):
        print(0)
        return
    start = 0
    while s[start] == 'R':
        start += 1
        cnt -= 1
    ans = cnt
    for i in range(start, start+cnt):
        if s[i] == 'R':
            ans -= 1
    print(ans) abc174d
def abc174d():
    n = int(input())
    s = input()
    cnt = s.count('R')
    if cnt == len(s):
        print(0)
        return
    start = 0
    while s[start] == 'R':
        start += 1
        cnt -= 1
    ans = cnt
    for i in range(start, start+cnt):
        if s[i] == 'R':
            ans -= 1
    print(ans)
abc174d()