Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
if n>k:
    for i in range(k):
        l.remove(max(l))
    print(sum(l))
else:
    print(0)

### FIXED CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
a=0
for i in range(max(0,n-k)):
    a+=l[i]
print(a)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=sys.stdin.readline
def resolve():
    n,k=map(int,input().split())
    xy=[tuple(map(int,input().split())) for _ in range(n)]
    ans=INF
    for a in range(n):
        for b in range(n):
            for c in range(a+1,n):
                for d in range(b+1,n):
                    x0,x1=sorted([xy[a][0],xy[c][0]])
                    y0,y1=sorted([xy[b][1],xy[d][1]])
                    count=0
                    for x,y in xy:
                        count+=(x0<=x<=x1 and y0<=y<=y1)
                    if count>=k: ans=min(ans,(x1-x0)*(y1-y0))
    print(ans)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=sys.stdin.readline
def resolve():
    n,k=map(int,input().split())
    X=[0]*n
    Y=[0]*n
    for i in range(n):
        X[i],Y[i]=map(int,input().split())
    ans=INF
    for a in range(n):
        for b in range(n):
            for c in range(a+1,n):
                for d in range(b+1):
                    x0,x1=sorted([X[a],X[c]])
                    y0,y1=sorted([Y[b],Y[d]])
                    count=0
                    for i in range(n):
                        if x0<=X[i]<=x1 and y0<=Y[i]<=y1:
                            count+=1
                    if count>=k:
                        ans=min(ans,(x1-x0)*(y1-y0))
    print(ans)
resolve()
### BUGGY CODE ###

X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = []
for a in A:
    for b in B:
        for c in C:
          ans.append(-(a+b+c))
        
import heapq
heapq.heapify(ans)
for _ in range(K):
    i = heapq.heappop(ans)
    print(-i)

### FIXED CODE ###

X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

# A,B,Cのリストを降順にソート
A.sort(reverse =True)
B.sort(reverse =True)
C.sort(reverse =True)

# A,B,Cを上からp,q,r番目を選択した場合にp*q*rがKより大きい組み合わせがKより上位に来ることはない
# A,B,Cを上から参照していき。p*q*rがK以下の場合はリストにa+b+cを追加，K以上の場合はbreak
D = []
for p in range(1,X+1):
    for q in range(1,Y+1):
        for r in range(1,Z+1):
            if p*q*r<=K:
                D.append(A[p-1]+B[q-1]+C[r-1])
            else:
                break
D.sort(reverse=True)

for i in range(K):
    print(D[i])
### BUGGY CODE ###

def resolve():
    import sys

    def LI():
        return list(map(int, sys.stdin.readline().rstrip().split()))  # 空白あり

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

    N, M = map(int, S().split())
    A = LI()
    A.sort()

    from bisect import bisect_left

    low = 2
    high = 2 * A[-1] + 1

    while low + 1 < high:
        mid = (low + high) // 2
        if sum(N - bisect_left([A[i] + A[j] for j in range(N)], mid) for i in range(N)) >= M:
            low = mid
        else:
            high = mid

    a = low  # a以上のA[i]+A[j]がM個以上となる最大のa

    from itertools import accumulate

    B = [0] + list(accumulate(A))

    r = 0
    ans = 0
    for i in range(N):  # a+1以上のA[i]+A[j]を足し合わせていく
        b = bisect_left([A[i] + A[j] for j in range(N)], a + 1)
        r += N - b
        ans += B[N] - B[b]
        ans += A[i] * (N - b)

    ans += (M - r) * a  # A[i]+A[j] == a となるものを足し合わせる

    print(ans)

if __name__ == '__main__':
    resolve()

### FIXED CODE ###

def resolve():
    import sys

    def LI():
        return list(map(int, sys.stdin.readline().rstrip().split()))  # 空白あり

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

    N, M = map(int, S().split())
    A = LI()
    A.sort()

    def f(n,x):  # A[n]+A[i]>=x となる i の最小値
        left = -1
        right = N
        while left + 1 < right:
            mid = (left + right) // 2
            if A[n] + A[mid] < x:
                left = mid
            else:
                right = mid
        return right

    low = 2 * A[0]
    high = 2 * A[-1] + 1

    while low + 1 < high:
        mid = (low + high) // 2
        if sum(N - f(i,mid) for i in range(N)) >= M:
            low = mid
        else:
            high = mid

    a = low  # a以上のA[i]+A[j]がM個以上となる最大のa

    from itertools import accumulate

    B = [0] + list(accumulate(A))

    r = 0
    ans = 0
    for i in range(N):  # a+1以上のA[i]+A[j]を足し合わせていく
        b = f(i,a+1)
        r += N - b
        ans += B[N] - B[b]
        ans += A[i] * (N - b)

    ans += (M - r) * a  # A[i]+A[j] == a となるものを足し合わせる

    print(ans)

if __name__ == '__main__':
    resolve()
### BUGGY CODE ###

s=input()
n=len(s)
si=int(s)
mod=2019
t=[si%mod]
for i in range(n):
    si-=int(s[i])*pow(10,n-1-i)
    t.append(si%mod)
from collections import Counter
d=Counter(t)
ans=0
for v in d.values():
    ans+=(v*(v-1))//2
print(ans)

### FIXED CODE ###

s=input()
n=len(s)
mod=2019
sum=0
p=1
d={}
d[0]=1
for i in range(n-1,-1,-1):
    sum=(sum+int(s[i])*p)%mod
    if sum in d:
        d[sum]+=1
    else:
        d[sum]=1
    p=(p*10)%mod
ans=0
for v in d.values():
    ans+=(v*(v-1))//2
print(ans)
### BUGGY CODE ###

N,X,M = map(int,input().split())

data = [X for i in range(M+1)]
val = set([X])

start = -1
period = -1
for i in range(1,M+1):
    data[i] = pow(data[i-1],2,M)
    if data[i] in val:
        for j in range(0,i):
            if data[j]==data[i]:
                start = j
                period = i-j
                break
    else:
        val.add(data[i])

if N<=M:
    print(sum(data[:N]))
else:
    res = sum(data[:start])

    backet = sum(data[start:start+period])
    Q = (N - start) // period
    R = (N- start) % period

    res += backet*Q + sum(data[start:start+R])
    print(res)

### FIXED CODE ###

N,X,M = map(int,input().split())

data = [X for i in range(M+1)]
val = set([X])

start = -1
period = -1
for i in range(1,M+1):
    data[i] = pow(data[i-1],2,M)
    if data[i] in val:
        for j in range(0,i):
            if data[j]==data[i]:
                start = j
                period = i-j
                break
        break
    else:
        val.add(data[i])

if N<=M:
    print(sum(data[:N]))
else:
    res = sum(data[:start])

    backet = sum(data[start:start+period])
    Q = (N - start) // period
    R = (N- start) % period

    res += backet*Q + sum(data[start:start+R])
    print(res)
### BUGGY CODE ###

import numpy as np
MOD = 10**9 + 7
H, W = map(int, input().split())
field = [['#'] * (W + 2)]
for i in range(H):
    field.append(list('#' + input() + '#'))
field.append(['#'] * (W + 2))

dp = np.zeros((H+2, W+2),dtype=int)
dp[H][W] = 1

for i in range(H,0,-1):
    for j in range(W,0,-1):
        if field[i][j] == '#':
            continue
        dp[i][j] %= MOD
        if field[i-1][j] == '.':
            dp[i-1][j] += dp[i][j]
        if field[i][j-1] == '.':
            dp[i][j-1] += dp[i][j]
print(dp[1][1] % MOD)

### FIXED CODE ###

MOD = 10**9 + 7
H, W = map(int, input().split())
field = [['#'] * (W + 2)]
for i in range(H):
    field.append(list('#' + input() + '#'))
field.append(['#'] * (W + 2))

dp = [[0 for _ in range(W+2)] for _ in range(H+2)]
dp[H][W] = 1

for i in range(H,0,-1):
    for j in range(W,0,-1):
        if field[i][j] == '#':
            continue
        else:
            dp[i][j] += dp[i][j+1] + dp[i+1][j]
        dp[i][j] %= MOD

print(dp[1][1])
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(len(l)-2):
    for j in range(i+1,len(l)):
        for k in range(j+1,len(l)):
            if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] and l[k]<l[i]+l[j]:
                ans+=1
print(ans)

### FIXED CODE ###

from bisect import bisect_left
 
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        k = bisect_left(l,l[i]+l[j])
        ans += k - j - 1

print(ans)
### BUGGY CODE ###

N = int(input())
li = list(map(int, input().split()))
ans = "Yes"
count = N - 1
while count >= 0:
    if li[count] - li[count-1] < -1:
        ans = "No"
        break
    elif li[count] - li[count-1] == -1:
        if count == 1:
            ans = "No"
            break
        else:
            tmp = count -2
            while tmp >= 0:
                if li[count] - li[tmp] <= -2:
                    ans = "No"
                    break
                elif li[count] >= li[tmp]:
                    count = tmp
                    break
                tmp -= 1
            if ans == "No":
                break
            count -= 1
print(ans)

### FIXED CODE ###

N = int(input())
li = list(map(int, input().split()))
ans = "Yes"
count = N - 1
while count >= 1:
    if li[count] - li[count-1] >= 0:
        pass
    elif li[count] - li[count-1] == -1:
        li[count-1] -= 1
    else:
        ans = "No"
        break
    count -= 1
print(ans)
### BUGGY CODE ###

import collections

def gcd(u,v):
	if v:
		return gcd(v, u % v)
	else:
		return u

n = int(raw_input())
elems = map(int , raw_input().split(' '))
dpp = [ None ] * len(elems)
dps = [ None ] * len(elems)
for i in range(len(elems)): dpp[i] = reduce(gcd, elems[:i+1])
for i in range(len(elems)): dps[len(elems) - 1 - i] = reduce(gcd, elems[- i - 1:])

r = 0
for i in range(len(elems)):
	u,v = dpp[i-1] if i-1 >= 0 else -1, dps[i+1] if i+1 < len(elems) else -1
	r  = max(r, gcd(u,v) if u != -1 and v != -1 else max(u,v))
print r



### FIXED CODE ###

import collections

def gcd(u,v):
	if v:
		return gcd(v, u % v)
	else:
		return u

n = int(raw_input())
elems = map(int , raw_input().split(' '))
dpp = [ None ] * len(elems)
dps = [ None ] * len(elems)
dpp[0] = elems[0]
for i in range(1,len(elems)): 
	dpp[i] = gcd(elems[i], dpp[i-1])
dps[len(elems) -1]  = elems[-1]
for i in range(len(elems) - 2, -1, -1): 
	dps[i] = gcd(elems[i], dps[i+1])
r = 0
for i in range(len(elems)):
	u,v = dpp[i-1] if i-1 >= 0 else -1, dps[i+1] if i+1 < len(elems) else -1
	r  = max(r, gcd(u,v) if u != -1 and v != -1 else max(u,v))
print r
### BUGGY CODE ###

n, m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

a.sort(reverse=True); b.sort(reverse=True)

def k(a, b, n, m):
    c, s = 0, 1
    if (n * m not in a) or (n * m not in b):
        return 0
    for i in reversed(range(n * m)):
        try:
            x = a.index(i + 1) + 1
            row = 1
        except ValueError:
            row = 0
        try:
            y = b.index(i + 1) + 1
            column = 1
        except ValueError:
            column = 0

        if row * column:
            s *= 1
        elif not row * column and row + column:
            s *= column * x + row * y
        else:
            if x * y - c > 0:
                s *= x * y - c
            else:
                s = 0
                break
        c += 1
        if s > 10 ** 9 + 7:
            s %= 10 ** 9 + 7
    return s

print(k(a, b, n, m))


### FIXED CODE ###

n, m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

a = set(a); b = set(b)
#print(a, b)

def k(a, b, n, m):
    s = 1
    x, y = 0, 0
    if (n * m not in a) or (n * m not in b):
        return 0
    for i, j in enumerate(reversed(range(n * m))):

        if (j + 1 in a) and (j + 1 in b):
            x += 1; y += 1
            #continue
        elif j + 1 in a:
            y += 1
            s *= x
        elif j + 1 in b:
            x += 1
            s *= y
        else:
            if x * y - i > 0:
                s *= x * y - i
            else:
                s = 0
                break
        if s > 10 ** 9 + 7:
            s %= 10 ** 9 + 7
        #print(i, j + 1, 'x=', x, 'y=', y, 's=', s)
    return s

if len(a) != n or len(b) != m:
    print(0)
else:
    print(k(a, b, n, m))

# TimeLimitExceeded
# indexで一個ずつ見つけていくのは時間がかかるということ。
### BUGGY CODE ###

from heapq import heapify, heappop, heappush
import sys
 
input = sys.stdin.readline
 
n, m = map(int, input().split())
A = list(map(int, input().split()))
heapify(A)
 
for _ in range(m):
    b, c = map(int, input().split())
    for _ in range(b):
        min_num = heappop(A)
        if min_num < c:
            heappush(A, c)
        else:
            heappush(A, min_num)
            break
 
total = sum(A)
print(total)

### FIXED CODE ###

from heapq import heapify, heappop, heappush
import sys

input = sys.stdin.readline

n, m = map(int, input().split())
A = list(map(int, input().split()))
heapify(A)

BC = [tuple(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: x[1], reverse=True)

for i in range(m):
    for _ in range(BC[i][0]):
        min_num = heappop(A)
        if min_num < BC[i][1]:
            heappush(A, BC[i][1])
        else:
            heappush(A, min_num)
            break

total = sum(A)
print(total)
### BUGGY CODE ###

N = int(input())
a = list(map(int, input().split()))

A = set(a)

ans = 0
for i in A:
    cnt = 0
    for j in a:
        if j == i or j == i + 1 or j == i - 1:
            cnt += 1
    ans = max(ans, cnt)
print(ans)


### FIXED CODE ###

N = int(input())
a = sorted(list(map(int, input().split())))

cnt = [0] * (10**5 + 2)

for i in a:
    cnt[i] += 1
    cnt[i + 1] += 1
    cnt[i + 2] += 1

print(max(cnt))
### BUGGY CODE ###

S = input()
in_ABC = S.count("ABC")
count = 0
while in_ABC != 0:
  S = S.replace("ABC", "BCA", 1)
  count += 1
  in_ABC = S.count("ABC")
print(count)  

### FIXED CODE ###

S = input().replace("BC", "D")
acc = 0
ans = 0
for s in S:
  if s == "B" or s == "C":
    acc = 0
    continue
  if s == "A":
    acc += 1
  if s == "D":
    ans += acc
print(ans)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
ans=""
for i in range(N):
  ans+=str(A.index(i+1)+1)
  if i!=N-1:
    ans+=" "
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
#A=int(input().split())
#print(A)
B=[ 0 for _ in range(N)]
#print(B)
ans=""
for i in range(N):
  B[A[i]-1]=i+1
#  ans+=str(A.index(i+1)+1)
#  if i!=N-1:

for i in range(N):
  ans+=str(B[i])
  if i!=N-1:
    ans+=" "
#print(B)
print(ans)
### BUGGY CODE ###

import heapq

n, m = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(m)]
ls2 = [[r, l] for l, r in ls]
heapq.heapify(ls)
heapq.heapify(ls2)
res = 0
while ls2:
    r, l = heapq.heappop(ls2)
    res += 1
    while ls:
        ll, rr = heapq.heappop(ls)
        if ll >= r:
            heapq.heappush(ls, [ll, rr])
            break
    ls2 = []
    for l, r in ls:
        heapq.heappush(ls2, [r, l])
print(res)

### FIXED CODE ###

n, m = map(int, input().split())
ls = [list(map(int, input().split())) for _ in range(m)]
ls.sort()
res = 1
rmin = float('inf')
for l, r in ls:
    if l >= rmin:
        res += 1
        rmin = r
    else:
        rmin = min(rmin, r)

print(res)
### BUGGY CODE ###

n = int(input())
s = [int(i) for i in input().split()]
for i, left in enumerate(s[0:-1]):
	for right in s[i+1:]:
		if left == right:
			print('NO')
			exit()
print('YES')

### FIXED CODE ###

n = int(input())
s = sorted([int(i) for i in input().split()])
for i, v in enumerate(s[0:-1]):
	if v == s[i+1]:
		print('NO')
		exit()
print('YES')
### BUGGY CODE ###

from collections import defaultdict

N,M = map(int,input().split())

A = defaultdict(list)
D = defaultdict(list)
DLen = defaultdict(int)
R = [i for i in range(1,N+1)]
for i in range(N+M-1):
    a,b = map(int,input().split())
    A[a].append(b)
    D[b].append(a)
    DLen[b] += 1
    try:
        R.remove(b)
    except ValueError:
        pass
    
D[R[0]].append(0)
Search = [(R[0],A[R[0]])]
Stepd = [R[0]]

while Search:
    now,NEX = Search.pop()
    for s in NEX:
        if DLen[s]>=2:
            DLen[s] -= 1
        else:
            D[s] = [now]
            Stepd.append(s)
            Search.append((s,A[s]))
            
for i in range(1,N+1):
    print(D[i][0])

### FIXED CODE ###

from collections import defaultdict
from collections import Counter

N,M = map(int,input().split())

A = defaultdict(list)
D = defaultdict(list)
DLen = defaultdict(int)
for i in range(N+M-1):
    a,b = map(int,input().split())
    A[a].append(b)
    #D[b].append(a)
    DLen[b] += 1

start = 0
for i in range(1,N+1):
    if DLen[i] == 0:
        start = i
        break
        
D[start].append(0)
Search = [(start,A[start])]
Stepd = [start]

while Search:
    now,NEX = Search.pop()
    for s in NEX:
        if DLen[s]>=2:
            DLen[s] -= 1
        else:
            D[s] = [now]
            Stepd.append(s)
            Search.append((s,A[s]))
            
for i in range(1,N+1):
    print(D[i][0])
### BUGGY CODE ###

X, K, D = [int(a) for a in list(input().split())]
X = abs(X)
for i in range(X//D):
    X -= D
    K -= 1
    if K == 0:
        print(abs(X))
        exit()
if K % 2 == 0:
    print(X)
else:
    print(abs(X-D))

### FIXED CODE ###

X, K, D = [int(a) for a in list(input().split())]
X = abs(X) 
q = X//D
r = X%D
if q >= K:
    print(X - D*K)
    exit()
rem = K - q
if rem % 2 == 0:
    print(r)
else:
    print(abs(D-r))
### BUGGY CODE ###

N = int(input())
a = [int(x) for x in input().split(" ")]
sum = 0
pow = 0
while any(a):
    zero = 0; one = 0
    for i in range(N):
        if a[i] % 2 == 0:
            zero += 1
        else:
            one += 1
        a[i] >>= 1
    sum += zero * one * 2 ** pow
    pow += 1
print(sum % (10 ** 9 + 7))

### FIXED CODE ###

import numpy as np

N = int(input())
a = np.array([int(x) for x in input().split(" ")], np.int64)
sum = 0
pow = 0
while any(a):
    one = np.count_nonzero(a & 1)
    sum += one * (N - one) * 2 ** pow
    sum %= (10 ** 9 + 7)
    pow += 1
    a >>= 1
print(sum)
### BUGGY CODE ###



import math
#素数列挙
def get_primes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0
    
    while True:
        prime = min(A)
        
        if prime > math.sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    sosus = set(get_primes(max(A)+1))
    dvd = set()






    for i in A:
        tmp=[]
        for j in sosus:
            if i % j ==0:
                tmp.append(j)
                while i % j ==0:
                    i //=j
            if i ==1:
                break
        sosus.difference_update(tmp)
        
        if i != 1:
            break
    else:
        print('pairwise coprime')
        return

    val = A[0]
    for i in A:
        val = math.gcd(i,val)

    if val ==1:
        print('setwise coprime')
    else:
        print('not coprime')

resolve()

### FIXED CODE ###


import math
#素数列挙
def get_primes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0
    
    while True:
        prime = min(A)
        
        if prime > math.sqrt(limit):
            break
            
        P.append(prime)
            
        A = [i for i in A if i%prime!=0]

    P.extend(A)
          
    return P


def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    sosus = set(get_primes(max(A)+1))
    dvd = set()



    val = A[0]
    for i in A:
        val = math.gcd(i,val)

    if val ==1:
        pass
    else:
        print('not coprime')
        return

    for i in A:
        tmp=[]
        for j in sosus:
            if j>i:
                break
            if i % j ==0:
                tmp.append(j)
                while i % j ==0:
                    i //=j
            if i ==1:
                break
            if i in sosus:
                
                tmp.append(i)
                i = 1
                break
        sosus.difference_update(tmp)
        
        if i != 1:
            break
    else:
        print('pairwise coprime')
        return

    print('setwise coprime')

resolve()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    C = LS()

    j = N-1
    cnt = 0
    # print(C)
    for i in range(N):
        if i >= j: break
        ci = C[i]
        if ci == 'W':
            # change
            # print(i, j)
            for k in range(j, i, -1):
                ck = C[k]
                if ck == 'R':
                    # print(i, j)
                    C[i], C[k] = ck, ci
                    cnt += 1
                    j = k-1
                    break
        # print(C)
    print(cnt)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    C = LS()

    j = N-1
    cnt = 0
    # print(C)
    for i in range(N):
        if i >= j: break
        ci = C[i]
        if ci == 'W':
            # change
            # print(i, j)
            for k in range(j, i, -1):
                j = k-1
                ck = C[k]
                if ck == 'R':
                    # print(i, j)
                    # C[i], C[k] = ck, ci
                    cnt += 1
                    break

    # print(C)
    print(cnt)


if __name__ == '__main__':
    solve()
### BUGGY CODE ###

K, S = map(int, input().split())
ans = 0

for x in range(K+1):
    for y in range(x+1):
        for z in range(y+1):
            if x+y+z == S:
                
                if x==y==z:
                    ans += 1
                elif x==y or y==z or x==z:
                    ans += 3
                else:
                    ans += 6
print(ans)

### FIXED CODE ###

k,s=map(int,input().split())
c=0
for i in range(k+1):
    for j in range(k+1):
        if s>=i+j and s-(i+j)<=k:
            c+=1
print(c)