import sys

N = int(input())
c = list(input())

right_R = N
for i in range(N-1,-1,-1):
    if c[i] == 'R':
        right_R = i
        break

left_W = -1
for i in range(N):
    if c[i] == 'W':
        left_W = i
        break

if right_R == N or left_W == -1:
    print(0)
    sys.exit(0)

ans = 0
p = left_W
q = right_R
while p < q:
    for i in range(p+1,N):
        if c[i] == 'W':
            p = i
            break
        if i == N-1:
            p = N
    for i in range(q-1,-1,-1):
        if c[i] == 'R':
            q = i
            break
        if i == 0:
            q = -1
    ans += 1

print(ans) import sys sys N = int(input()) N int(input()) int input() input c = list(input()) c list(input()) list input() input right_R = N right_R N for i in range(N-1,-1,-1):
    if c[i] == 'R':
        right_R = i
        break i range(N-1,-1,-1) range N-1 N 1 -1 -1 if c[i] == 'R':
        right_R = i
        break c[i] == 'R' c[i] c i 'R' right_R = i right_R i break left_W = -1 left_W -1 for i in range(N):
    if c[i] == 'W':
        left_W = i
        break i range(N) range N if c[i] == 'W':
        left_W = i
        break c[i] == 'W' c[i] c i 'W' left_W = i left_W i break if right_R == N or left_W == -1:
    print(0)
    sys.exit(0) right_R == N or left_W == -1 right_R == N right_R N left_W == -1 left_W -1 print(0) print 0 sys.exit(0) sys.exit sys exit 0 ans = 0 ans 0 p = left_W p left_W q = right_R q right_R while p < q:
    for i in range(p+1,N):
        if c[i] == 'W':
            p = i
            break
        if i == N-1:
            p = N
    for i in range(q-1,-1,-1):
        if c[i] == 'R':
            q = i
            break
        if i == 0:
            q = -1
    ans += 1 p < q p q for i in range(p+1,N):
        if c[i] == 'W':
            p = i
            break
        if i == N-1:
            p = N
     i range(p+1,N) range p+1 p 1 N if c[i] == 'W':
            p = i
            break
         c[i] == 'W' c[i] c i 'W' p = i p i break if i == N-1:
            p = N
     i == N-1 i N-1 N 1 p = N p N for i in range(q-1,-1,-1):
        if c[i] == 'R':
            q = i
            break
        if i == 0:
            q = -1
     i range(q-1,-1,-1) range q-1 q 1 -1 -1 if c[i] == 'R':
            q = i
            break
         c[i] == 'R' c[i] c i 'R' q = i q i break if i == 0:
            q = -1
     i == 0 i 0 q = -1 q -1 ans += 1 ans 1 print(ans) print ans p = left_W left_W p c = list(input()) list(input()) c q = i i q left_W = i i left_W ans = 0 0 ans right_R = i i right_R ans += 1 1 ans left_W = -1 -1 left_W q = right_R right_R q N = int(input()) int(input()) N q = -1 -1 q p = N N p right_R = N N right_R p = i i p
import sys

N = int(input())
c = list(input())

right_R = N
for i in range(N-1,-1,-1):
    if c[i] == 'R':
        right_R = i
        break

left_W = -1
for i in range(N):
    if c[i] == 'W':
        left_W = i
        break

if right_R == N or left_W == -1:
    print(0)
    sys.exit(0)

ans = 0
p = left_W
q = right_R
while p < q:
    for i in range(p+1,N):
        if c[i] == 'W':
            p = i
            break
        if i == N-1:
            p = N
    for i in range(q-1,-1,-1):
        if c[i] == 'R':
            q = i
            break
        if i == 0:
            q = -1
    ans += 1

print(ans)