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

n = int(input())
left = 0
right = n - 1
print(left, flush=True)
sl = input()
if sl[0] == "V":
    quit()
while left < right:
    mid = (left + right) // 2
    print(mid, flush=True)
    sm = input()
    if sm[0] == "V":
        quit()

    if (mid - left + 1) % 2 == 1 and sm != sl:
        right = mid
        continue
    elif (mid - left + 1) % 2 == 0 and sm == sl:
        right = mid
    else:
        left = mid
    sm = sl


### FIXED CODE ###

n = int(input())

left = 0
right = n
print(left, flush=True)
sl = input()
if sl[0] == "V":
    quit()
while right - left > 1:
    mid = (left + right) // 2
    print(mid, flush=True)
    sm = input()
    if sm[0] == "V":
        quit()

    if ((mid - left) % 2 == 1) ^ (sl == sm):
        left = mid
        sl = sm
    else:
        right = mid
### BUGGY CODE ###

import sys
input=lambda: sys.stdin.readline().rstrip()
n,s=map(int,input().split())
A=[int(i) for i in input().split()]
mod=998244353
B=[[[] for i in range(s+1)] for _ in range(n+1)]
ans=0
for i in range(n):
  a=A[i]
  if a<=s:
    B[i+1][a]+=[i+1]
  for j in range(s+1):
    B[i+1][j]+=B[i][j]
    if j-a>=0 and B[i][j-a]:
      B[i+1][j]+=B[i][j-a]
    
  while B[i+1][s]:
    aa=B[i+1][s].pop()
    ans+=aa*(n-i)
  ans%=mod
print(ans)

### FIXED CODE ###

import sys
input=lambda: sys.stdin.readline().rstrip()
n,s=map(int,input().split())
A=[int(i) for i in input().split()]
mod=998244353
B=[[0]*(s+1) for _ in range(n+1)]
ans=0
for i in range(n):
  a=A[i]
  if a<s:
    B[i+1][a]+=i+1
  elif a==s:
    B[i+1][a]+=(i+1)*(n-i)
  for j in range(s+1):
    if j<=s:
      B[i+1][j]+=B[i][j]
    if 0<=j-a and j<s:
      B[i+1][j]+=B[i][j-a]
    if 0<=j-a and j==s:
      B[i+1][j]+=B[i][j-a]*(n-i)
    B[i+1][j]%=mod
print(B[n][s])
### BUGGY CODE ###

import sys
n=int(input())
a=list(map(int,input().split()))

if n==1:
    print(1)
    sys.exit()
"""
def fsort(a,max):
    n=len(a)
    f=[0]*(max+1)
    b=[0]*n

    for i in range(n):
        f[a[i]]+=1
    for i in range(1, max+1):
        f[i]+=f[i-1]
    for i in range(n-1,-1,-1):
        f[a[i]]-=1; b[f[a[i]]]=a[i]
    for i in range(n):
        a[i]=b[i]

fsort(a, 10**6)
"""
def quicksort(a, left: int, right: int):
    #a[left]〜a[right]をクイックソート
    pl=left
    pr=right
    pivot= a[(left +right)//2]

    #print(f'a[{left}]~a[{right}] : ', *a[left : right +1])

    while pl<=pr:
        while a[pl] <pivot: pl+=1
        while a[pr] >pivot: pr-=1
        if pl <= pr:
            a[pl], a[pr]= a[pr], a[pl]
            pl+=1
            pr-=1

    if left < pr: quicksort(a, left, pr)
    if pl < right: quicksort(a, pl, right)

def quick_sort(a):
    quicksort(a, 0, len(a)-1)

quick_sort(a)
if a[0]==1:
    if a[1]==1:
        print(0)
        sys.exit()
    else:
        print(1)
        sys.exit()

if a[0]==a[1]:
    count=0
else:
    count=1

for i in range(n-2):
    if a[i+2]==a[i+1]:
        continue
    if a[i+1]==a[i]:
        continue
    for l in range(i+1):
        if a[i+1]%a[l]==0:
            break
        if i==l:
            count+=1

if a[n-1]!=a[n-2]:
    for i in range(n):
        if a[n-1]%a[i]==0:
            break
        if i==n-2:
            count+=1

print(count)

### FIXED CODE ###

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

a.sort()
amx=max(a)+1
l=[True]*amx
ans=0

for i in range(n-1):
    if l[a[i]]:
        for j in range(a[i],amx,a[i]):
            l[j]=False
        if a[i]<a[i+1]:
            ans+=1

if l[-1]:
    ans+=1

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

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = [LIST() for _ in range(N)]

ans = 0
sum_ = 0
while 1:
	delete = [0]*(N+1)
	for i in range(1, N):
		if len(A[i-1]) == 0:
			continue
		if i == A[A[i-1][0]-1][0]:
			delete[i] = 1
			delete[A[i-1][0]] = 1
	if sum(delete) == 0:
		print(-1)
		sys.exit(0)

	for i in range(1, len(delete)):
		if delete[i] == 1:
			sum_ += A[i-1].pop(0)
	ans += 1
	if sum_ == N*(N-1)*(N+1)//2:
		break
	
print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	N = INT()
	A = [LIST() for _ in range(N)]

	graph_out = defaultdict(list)
	graph_in = defaultdict(list)
	match_id = [[0]*N for _ in range(N)]

	def toid(i, j):  # 選手から試合IDに変換
		if i > j: i, j = j, i
		return match_id[i][j]

	cnt = 0
	for i in range(N):
		for j in range(N):
			if i < j:
				match_id[i][j] = cnt
				cnt += 1

	V = N*(N-1)//2
	gout = [[] for _ in range(V)]
	gin = [[] for _ in range(V)]
	deg = [0]*(V)
	for i in range(N):
		for j in range(N-2):
			gout[toid(i, A[i][j]-1)].append(toid(i, A[i][j+1]-1))
			deg[toid(i, A[i][j+1]-1)] += 1
			gin[toid(i, A[i][j+1]-1)].append(toid(i, A[i][j]-1))
	# トポロジカルソート
	ans = [v for v in range(V) if deg[v]==0]
	deq = deque(ans)
	used = [0]*V
	while deq:
	    v = deq.popleft()
	    for t in gout[v]:
	        deg[t] -= 1
	        if deg[t]==0:
	            deq.append(t)
	            ans.append(t)
	if any(deg):
		print(-1)
		exit()

	cnt = [0]*V  # cntが入り次数に達したら発火
	day = [0]*V
	q = deque(ans)
	ans = 0

	while q:
		n = q.popleft()
		for node in gout[n]:
			cnt[node] += 1
			if cnt[node] == len(gin[node]):
				q.append(node)
				day[node] = day[n] + 1
				ans = day[node]
	print(ans+1) 

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

from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_list_of_int():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


# inputs
N, W = 0, 0
Ws, Vs = [0], [0]


def set_inputs():
    global N, W, Ws, Vs
    N, W = get_list_of_int()
    ws, vs = [], []
    for _ in range(N):
        w, v = get_list_of_int()
        ws.append(w)
        vs.append(v)
    Ws, Vs = ws, vs


def main():
    set_inputs()
    values = [0] * (W + 1)
    items = [set()] * (W + 1)
    for w in range(1, W + 1):
        values[w], items[w] = max((values[w - Ws[i]] + Vs[i], items[w - Ws[i]] | {i}) if w - Ws[i] >= 0 and i not in items[w - Ws[i]] else (values[w-1], items[w-1]) for i in range(N))
    print(values[W])


if __name__ == '__main__':
    main()


### FIXED CODE ###

from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_list_of_int():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


# inputs
N, W = 0, 0
Ws, Vs = [0], [0]


def set_inputs():
    global N, W, Ws, Vs
    N, W = get_list_of_int()
    ws, vs = [], []
    for _ in range(N):
        w, v = get_list_of_int()
        ws.append(w)
        vs.append(v)
    Ws, Vs = ws, vs


def main():
    set_inputs()
    values = [0] * (W + 1)
    items = [0] * (W + 1)
    for w in range(1, W + 1):
        values[w], items[w] = max((values[w - Ws[i]] + Vs[i], items[w - Ws[i]] | 1 << i) if w - Ws[i] >= 0 and (items[w - Ws[i]] & 1 << i) == 0 else (values[w-1], items[w-1]) for i in range(N))
    print(values[W])


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

import sys

input = sys.stdin.readline

n = int(input())
graph = [[] for i in range(n + 1)]
cost = [[[] for i in range(n + 1)] for j in range(n + 1)]
for i in range(n - 1):
    u, v, w = map(int, input().split())
    graph[u].append(v)
    graph[v].append(u)
    cost[u][v] = w
    cost[v][u] = w
ans = [] * (n + 1)


def dfs(a):
    dist = [-1] * (n + 1)
    stack = [a]
    dist[a] = 0
    while stack:
        v = stack.pop()
        for w in graph[v]:
            if dist[w] == -1:
                dist[w] = dist[v] + cost[w][v]
                dist[w] %= 2
                stack.append(w)
            else:
                continue
    return dist


dist = dfs(1)
print(*dist[1:], sep="\n")


### FIXED CODE ###

import sys

input = sys.stdin.readline

n = int(input())
graph = [[] for i in range(n + 1)]
for i in range(n - 1):
    u, v, w = map(int, input().split())
    graph[u].append((v, w))
    graph[v].append((u, w))


def dfs(a):
    dist = [-1] * (n + 1)
    stack = [a]
    dist[a] = 0
    while stack:
        v = stack.pop()
        for b, w in graph[v]:
            if dist[b] == -1:
                dist[b] = (dist[v] + w) % 2
                stack.append(b)
            else:
                continue
    return dist


dist = dfs(1)
print(*dist[1:], sep="\n")
### BUGGY CODE ###

import math
n, m, d = map(int, input().split())
pownum = pow(n,m-2)
num = 0

if d > n - 1:
    num = 0
elif d == 0:
    num = (n - d)
else:
    num = (n - d) * 2


numPow = num*pownum * (m-1)
ans = numPow/(pownum*n*n)
print(ans)


# elif d == n - 1:
#     num = m - 1
# elif 2 * d > n - 1:
#     num = (n - d) * (m - 1)


# n, m, s, t = map(int, input().split())
# u = []
# v = []
# a = []
# b = []
#
# for i in range(m):
#     in1, in2, in3, in4 = map(int, input().split())
#
#     u.append(in1)
#     v.append(in2)
#     a.append(in3)
#     b.append(in4)
#
# print(u,v,a,b)




### FIXED CODE ###

import math
n, m, d = map(int, input().split())
num = 0

if d > n - 1:
    num = 0
elif d == 0:
    num = (n - d)
else:
    num = (n - d) * 2


ans = num*  (m-1)/(n*n)
print(ans)


# elif d == n - 1:
#     num = m - 1
# elif 2 * d > n - 1:
#     num = (n - d) * (m - 1)


# n, m, s, t = map(int, input().split())
# u = []
# v = []
# a = []
# b = []
#
# for i in range(m):
#     in1, in2, in3, in4 = map(int, input().split())
#
#     u.append(in1)
#     v.append(in2)
#     a.append(in3)
#     b.append(in4)
#
# print(u,v,a,b)
### BUGGY CODE ###

from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math

def main():
    kouji_num, person_num = map(int, input().split())
    koji_data = [list(map(int, input().split())) for i in range(kouji_num)]
    person_data = [int(input()) for i in range(person_num)]

    event_list = [0 for i in range(kouji_num * 2)]
    now_kouji = set()

    for i in range(kouji_num):
        start, fin, position = koji_data[i]
        event_list[2 * i] = (start - position - 0.25, 1, position)
        event_list[2 * i + 1] = (fin - position - 0.75, 0, position)
    event_list.sort(key=lambda x: x[0])

    now_ind = 0
    for i in range(person_num):
        person_start = person_data[i]
        while now_ind < kouji_num * 2:
            time_data, flg, position = event_list[now_ind]
            if time_data > person_start:
                break
            if flg:
                now_kouji.add(position)
            else:
                now_kouji.remove(position)
            now_ind += 1
        if len(now_kouji) == 0:
            ans = -1
        else:
            ans = min(now_kouji)
        print(ans)





if __name__ == '__main__':
    main()



### FIXED CODE ###

from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math

def main():
    kouji_num, person_num = map(int, input().split())
    koji_data = [list(map(int, input().split())) for i in range(kouji_num)]
    person_data = [int(input()) for i in range(person_num)]

    event_list = [0 for i in range(kouji_num * 2)]
    now_kouji = set()

    for i in range(kouji_num):
        start, fin, position = koji_data[i]
        event_list[2 * i] = (start - position - 0.25, 1, position)
        event_list[2 * i + 1] = (fin - position - 0.75, 0, position)
    event_list.sort(key=lambda x: x[0])

    ans = 10 ** 9 + 1
    now_ind = 0
    for i in range(person_num):
        person_start = person_data[i]
        while now_ind < kouji_num * 2:
            time_data, flg, position = event_list[now_ind]
            if time_data > person_start:
                break

            if flg:
                now_kouji.add(position)
                ans = min(ans, position)
            else:
                now_kouji.remove(position)
                if len(now_kouji) == 0:
                    ans = 10 ** 9 + 1
                elif ans == position:
                    ans = min(now_kouji)

            now_ind += 1
        if ans == 10 ** 9 + 1:
            print(-1)
        else:
            print(ans)





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

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

C.sort(reverse=True)

W=0
for j in range(len(C)):
    if C[j]==W:
        pass
    elif C.count(C[j])>=4:
        if W==0:
            
            print(C[j]*C[j])
            exit()
        else:
            print(W*C[j])
            exit()
    elif C.count(C[j])>=2:
        if W==0:
            W=C[j]
        else:
            print(W*C[j])
            exit()
print(0)

### FIXED CODE ###

import collections
N=int(input())
A=list(map(int,input().split()))
AC=collections.Counter(A)
AM=AC.most_common()
AM.sort(reverse=True)
#print(AM)
H=0
for i in range(len(AM)):
    if H==0:
        if AM[i][1]>=4:
            print(AM[i][0]**2)
            exit()
        elif AM[i][1]>=2:
            H=AM[i][0]
    else:
        if AM[i][1]>=2:
            
            print(AM[i][0]*H)
            exit()
print(0)
### BUGGY CODE ###

w,h,n = map(int,input().split())
gra = [[1 for i in range(w)] for i in range(h)]
for i in range(n):
    x,y,a = map(int,input().split())
    for j in range(n):
        if a == 1:
            for k in range(h):
                for l in range(x):
                    gra[k][l] = 0
        elif a == 2:
            for k in range(h):
                for l in range(x,w):
                    gra[k][l] = 0
        elif a == 3:
            for k in range(y):
                for l in range(w):
                    gra[k][l] = 0
        else:
            for k in range(y,h):
                for l in range(w):
                    gra[k][l] = 0
print(sum(map(sum, gra)))

### FIXED CODE ###

w,h,n = map(int,input().split())
up = h
down = 0
left = 0
right = w
for i in range(n):
    x, y, a = map(int,input().split())
    if a == 1:
        left = max(left,x)
    elif a == 2:
        right = min(right,x)
    elif a == 3:
        down = max(down,y)
    else:
        up = min(up,y)
print(max(0, right - left) * max(0, up - down))
### BUGGY CODE ###

import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

val = (n-1) // 2

arr = list(map(int, arr_data[1]))

arr_sort = sorted(arr)

for v in arr:

    i = arr_sort.index(v)
    
    arr01 = arr_sort[:i] + arr_sort[i + 1:]
    
    print(arr01[val])

### FIXED CODE ###

import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])

val = (n-1) // 2

arr = list(map(int, arr_data[1]))

arr_sort = sorted(arr)

val1 = arr_sort[(n // 2)-1]
val2 = arr_sort[(n // 2)]

for v in arr:
    
    if v<=val1:
        
        print(val2)
        
    else:
        
        print(val1)
### BUGGY CODE ###

import sys

from decimal import Decimal

sys.setrecursionlimit(200000)


def solve(n, d, x):
    if not n:
        return 0
    return d + (2 * n - 1) * x / 2 + solve(n - 1, ((n + 1) * d + 5 * x / 2) / n, (n + 2) * x / n)


print(solve(*map(Decimal, input().split())))


### FIXED CODE ###

def solve(n, d, x):
    ans = 0
    while n:
        ans += d + (2 * n - 1) * x / 2
        d = ((n + 1) * d + 5 * x / 2) / n
        x *= (n + 2) / n
        n -= 1
    return ans


print('{:.10f}'.format(solve(*map(float, input().split()))))
### BUGGY CODE ###

h,w = map(int,input().split())
ans = 0
grid = [['#']*(w+2)]
for i in range(h):
    grid += [ ['#'] + list(input()) + ['#']]

grid += [['#']*(w+2)]
#print(grid)
if grid[1][1] != '.':
    grid[1][1] = '.'
    ans += 1
from collections import deque

q = deque()
q.append([1,1,0])
point = 10**18
while q:
    k = q.popleft()
    x,y,p = k[0],k[1],k[2]
    if x == h and y == w:
        point = min(point,p)
    elif x == h:
        if grid[x][y+1] == '#':
            p += 1
        q.append([x,y+1,p])
    elif y == w:
        if grid[x+1][y] == '#':
            p += 1
        q.append([x+1,y,p])
    else:
        if grid[x+1][y] == '#':
            q.append([x+1,y,p+1])
        else:
            q.append([x+1,y,p])
        if grid[x][y+1] == '#':
            q.append([x,y+1,p+1])
        else:
            q.append([x,y+1,p])
ans += point
print(ans)

### FIXED CODE ###

h,w = map(int,input().split())
grid = []
for _ in range(h):
    grid.append(list(input()))
 
dp = [[0]*(w+1) for i in range(h+1)]
#dp[i][j] = i,jでの最小の操作回数
 
if grid[0][0] == '#':
    dp[0][0] += 1
 
for i in range(1,h):
    p = 0
    if grid[i][0] == '#' and grid[i-1][0] == '.':
        p += 1
    dp[i][0] = dp[i-1][0] + p
 
for i in range(1,w):
    p = 0
    if grid[0][i] == '#' and grid[0][i-1] == '.':
        p += 1
    dp[0][i] = dp[0][i-1] + p
 
for x in range(1,h):
    for y in range(1,w):
        a,b = 0,0
        if grid[x][y] == '#' and grid[x-1][y] == '.':
            a += 1
        if grid[x][y] == '#' and grid[x][y-1] == '.':
            b += 1
        dp[x][y] = min(dp[x-1][y] + a,dp[x][y-1] + b)
print(dp[h-1][w-1])
#print(dp)
### BUGGY CODE ###

from collections import defaultdict
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]

U = 80 * 80 + 10
Um = U // 2

dp = [[[0] * (U + 1) for _ in range(W)] for _ in range(H)]
d = abs(A[0][0] - B[0][0])
dp[0][0][Um + d] = 1
dp[0][0][Um - d] = 1


for i in range(H):
    for j in range(W):
        if i < H - 1:
            d = abs(A[i + 1][j] - B[i + 1][j])
            for k in range(U - d + 1):
                dp[i + 1][j][k + d] |= dp[i][j][k]
            for k in range(d, U + 1):
                dp[i + 1][j][k - d] |= dp[i][j][k]
        if j < W - 1:
            d = abs(A[i][j + 1] - B[i][j + 1])
            for k in range(U - d + 1):
                dp[i][j + 1][k + d] |= dp[i][j][k]
            for k in range(d, U + 1):
                dp[i][j + 1][k - d] |= dp[i][j][k]

ans = 10 ** 18
for i, p in enumerate(dp[H - 1][W - 1]):
    if p:
        ans = min(ans, abs(Um - i))
print(ans)

### FIXED CODE ###

import numpy as np
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

H, W = map(int, input().split())
A = np.array([input().split() for _ in range(H)], dtype=int)
B = np.array([input().split() for _ in range(H)], dtype=int)
dif = np.abs(A - B).tolist()

U = (H + W) * 80
Um = U // 2

dp = [[[] for _ in range(W)] for _ in range(H)]
X = np.zeros(U + 1, dtype=bool)
X[Um + dif[0][0]] = True
X[Um - dif[0][0]] = True
dp[0][0] = X


for i in range(H):
    for j in range(W):
        if i == j == 0:
            continue
        d = dif[i][j]
        X = np.zeros(U + 1, dtype=bool)
        if d:
            if i > 0:
                X[d:] |= dp[i - 1][j][:-d]
                X[:-d] |= dp[i - 1][j][d:]
            if j > 0:
                X[d:] |= dp[i][j - 1][:-d]
                X[:-d] |= dp[i][j - 1][d:]
        else:
            if i > 0:
                X |= dp[i - 1][j]
            if j > 0:
                X |= dp[i][j - 1]
        dp[i][j] = X

tmp = np.arange(U+1)[dp[H-1][W-1]]
ans = np.abs(tmp - Um).min()
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[2]:


import collections


# In[18]:


N = int(input())
clist = input()


# In[19]:


c = collections.Counter(clist)
cr = c["R"]
mylist = [x for x in clist]
mylist_r = list(reversed(mylist))
ans = 0
while mylist[:cr].count("R") != cr:
    W_i = mylist.index("W")
    R_i = mylist_r.index("R")
    mylist[W_i] = "R"
    mylist[N-R_i-1] = "W"
    mylist_r[N-W_i-1] = "R"
    mylist_r[R_i] = "W"
    ans += 1
print(ans)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[2]:


import collections


# In[26]:


N = int(input())
clist = input()


# In[27]:


c = collections.Counter(clist)
cr = c["R"]
# mylist = [x for x in clist]
# mylist_r = list(reversed(mylist))
# ans = 0
# while mylist[:cr].count("R") != cr:
#     W_i = mylist.index("W")
#     R_i = mylist_r.index("R")
#     mylist[W_i] = "R"
#     mylist[N-R_i-1] = "W"
#     mylist_r[N-W_i-1] = "R"
#     mylist_r[R_i] = "W"
#     ans += 1
# print(ans)
ans = clist[:cr].count("W")
print(ans)


# In[ ]:
### BUGGY CODE ###

n = int(input())
s = list(input())
ans = 0

for i in range(n):
  if s[i] == "R":
    for j in range(n):
      if s[j] == "G":
        for k in range(n):
          if s[k] == "B":
            if float(k) == (i+j)/2 or float(i) == (j+k)/2 or float(j) == (k+i)/2:
              pass
            else:
              ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
s = list(input())

r = s.count('R')
g = s.count('G')
b = s.count('B')

cnt = 0
for i in range(n):
    for j in range(i+1,n):
        k = j*2-i
        if k >= n:
            break
        elif s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            cnt +=1
print(r*g*b - cnt)
### BUGGY CODE ###

N = int(input())
nums = [i for i in range(1, N + 1)]
if (N - 1) % 2 == 0:
    print(N * ((N - 1) // 2))
else:
    # 12 =>
    print(N * ((N - 1) // 2) + (N // 2))


### FIXED CODE ###

N = int(input())
# nums = [i for i in range(1, N + 1)]
if (N - 1) % 2 == 0:
    print(N * ((N - 1) // 2))
else:
    # 12 =>
    print(N * ((N - 1) // 2) + (N // 2))