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

n = int(input())
s = [input() for _ in range(n)]
count = []
max_list = []

for item in s:
    count_i = s.count(item)
    count.append(count_i)

for i in range(n):
    if count[i] == max(count) and not (s[i] in max_list):
        max_list.append(s[i])

max_list = sorted(max_list)
for item in max_list:
    print(item)

### FIXED CODE ###

from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s)
ans = []
max_values = max(c.values())

for k in c.keys():
    if c[k] == max_values:
        ans.append(k)

ans = sorted(ans)
for item in ans:
    print(item)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter

N, P = map(int, readline().split())
S = list(map(int, read().rstrip().decode()))

def solve_2(S):
    ind = (i for i, x in enumerate(S, 1) if x % 2 == 0)
    return sum(ind)

def solve_5(S):
    ind = (i for i, x in enumerate(S, 1) if x % 5 == 0)
    return sum(ind)

def solve(S,P):
    if P == 2:
        return solve_2(S)
    if P == 5:
        return solve_5(S)
    S = S[::-1]
    T = [0] * len(S)
    T[0] = S[0] % P
    power = 1
    for i in range(1, len(S)):
        power *= 10
        T[i] = T[i-1] + power * S[i]
        T[i] %= P
    counter = Counter(T)
    return sum(x * (x - 1) // 2 for x in counter.values()) + counter[0]


print(solve(S,P))

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter

N, P = map(int, readline().split())
S = list(map(int, read().rstrip().decode()))

def solve_2(S):
    ind = (i for i, x in enumerate(S, 1) if x % 2 == 0)
    return sum(ind)

def solve_5(S):
    ind = (i for i, x in enumerate(S, 1) if x % 5 == 0)
    return sum(ind)

def solve(S,P):
    if P == 2:
        return solve_2(S)
    if P == 5:
        return solve_5(S)
    S = S[::-1]
    T = [0] * len(S)
    T[0] = S[0] % P
    power = 1
    for i in range(1, len(S)):
        power *= 10
        power %= P
        T[i] = T[i-1] + power * S[i]
        T[i] %= P
    counter = Counter(T)
    return sum(x * (x - 1) // 2 for x in counter.values()) + counter[0]


print(solve(S,P))
### BUGGY CODE ###

n = int(input())

nums = list(map(int, input().split()))

ans = 0
for i in range(n):
    for j in range(i+1, n):
        ans += nums[i] * nums[j]

print(ans % (10**9+7))

### FIXED CODE ###

n = int(input())

nums = list(map(int, input().split()))

ans = 0
s = sum(nums)
for i in range(n):
    s -= nums[i]
    ans += nums[i] * s

print(ans % (10**9+7))
### BUGGY CODE ###

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

ans = 10**6
for i in range(n):
    ans = min(s[:i].count("W") + s[i+1:].count("E"), ans)

print(ans)

### FIXED CODE ###

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

w_series = [0]
e_series = [0]
for c in s:
    if c == "W":
        w_series.append(w_series[-1]+1)
    else:
        w_series.append(w_series[-1])
for c in s[::-1]:
    if c == "E":
        e_series.append(e_series[-1]+1)
    else:
        e_series.append(e_series[-1])
e_series = e_series[::-1]

ans = n
for x in zip(w_series[1:], e_series[:-1]):
    ans = min(sum(x)-1, ans)
print(ans)
### BUGGY CODE ###

import numpy as np

n = int(input())
A = np.array(list(map(int, input().split())))

ans = []
for i in range(n):
  tmpidx = np.argmin(A)
  A[tmpidx] = 10 ** 9
  print(tmpidx+1)

### FIXED CODE ###

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

ans = [0 for _ in range(n)]
for i in range(n):
  ans[A[i]-1] = i+1

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

n,k = map(int,input().split())
p = list(map(int,input().split()))
eg = [sum(p[i:i+k])+k for i in range(n-k+1)]
maxsum = 0
for i in range(n-k+1):
	cnt = eg[i]/2
	if cnt >= maxsum:
		maxsum = cnt
print(maxsum)

### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
u = sum(p[0:k])
maxsum = u
for i in range(1, n-k+1):
	u = u + p[i+k-1] - p[i-1]
	if u >= maxsum:
		maxsum = u
print((maxsum+k)/2)
### BUGGY CODE ###

# B

A,B,C,K = map(int,input().split())

ans = 0

for i in range(1,K+1):
  if i <= A:
    ans += 1
  elif i <= A+B:
    pass
  else:
    ans -= 1

print(ans)

### FIXED CODE ###

# B

A,B,C,K = map(int,input().split())

ans = 0

if K <= A:
  ans = K
elif K <= A+B:
  ans = A
elif K <= A+B+C:
  ans = A-(K-(A+B))

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

def merge(S, left, mid, right, cnt):
	S1 = S[:left]
	S2 = S[left:mid][::-1]
	S3 = S[mid:right][::-1]
	S4 = S[right:]
	while S2 and S3:
		cnt += 1
		S1.append(min(S2,S3,key = lambda X:X[-1]).pop())
	S = S1 + S2[::-1] + S3[::-1] + S4
	cnt += (len(S2)+len(S3))
	return S,cnt

def merge_sort(S, left = 0, right = 500000, cnt = 0):
	right = min(len(S),right)
	if left+1 < right:
		mid = (left+right) // 2
		S,cnt = merge_sort(S, left, mid, cnt)
		S,cnt = merge_sort(S, mid, right, cnt)
		S,cnt = merge(S, left, mid, right, cnt)
	return S, cnt

if __name__ == '__main__':
	n = int(input())
	S = [int(s) for s in input().split()]
	S,cnt = merge_sort(S)
	print(*S)
	print(cnt)

### FIXED CODE ###

def merge(S, left, mid, right):
	global cnt
	L = S[left:mid] + [float('inf')]
	R = S[mid:right] + [float('inf')]
	i,j = 0,0
	for k in range(left,right):
		if L[i] <= R[j]:
			S[k] = L[i]
			i += 1
		else:
			S[k] = R[j]
			j += 1
	cnt += right - left


def merge_sort(S, left = 0, right = 500000):
	right = min(len(S),right)
	if left+1 < right:
		mid = (left+right) // 2
		merge_sort(S, left, mid)
		merge_sort(S, mid, right)
		merge(S, left, mid, right)


if __name__ == '__main__':
	n = int(input())
	S = [int(s) for s in input().split()]
	cnt = 0
	merge_sort(S)
	print(*S)
	print(cnt)
### BUGGY CODE ###

#!/usr/bin/env python3
#ABC74 C

a,b,c,d,e,f = map(int,input().split())

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
water = []
suger = []
for A in range(s+1):
    for B in range(t+1):
        if 100*a*A + 100*b*B != 0:
            water.append(100*a*A + 100*b*B)

for C in range(u+1):
    for D in range(v+1):
        suger.append(c*C + d*D)

ans1 = 0
ans2 = 0
for W in water:
    for S in suger:
        if W + S <= f:
            if W//100*e >= S:
                if concentration < S/(W+S):
                    concentration = S/(W+S)
                    ans1 = W+S
                    ans2 = S
if ans1 == 0:
    ans1 = 100*a
print(ans1,ans2)


### FIXED CODE ###

#!/usr/bin/env python3
#ABC74 C

a,b,c,d,e,f = map(int,input().split())

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
solution = 0
suger = 0
for A in range(s+1):
    for B in range(t+1):
        for C in range(u+1):
            for D in range(v+1):
                if 100*a*A + 100*b*B + c*C + d*D <= f:
                    if (a*A+b*B)*e >= (c*C + d*D):
                        if 100*a*A + 100*b*B + c*C + d*D != 0:
                            if concentration < (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D):
                                concentration = (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D)
                                solution = 100*a*A + 100*b*B + c*C + d*D
                                suger = c*C + d*D
if solution == 0:
    solution = 100*a
print(solution,suger)
### BUGGY CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
array = []
ans = 0

for i in range(N):
  if A[i] not in array:
    array.append(A[i])
    if A.count(A[i]) % 2 == 1:
      ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
array = []
ans = 0
A.sort()
count = 0

for i in range(N):
  count += 1
  if i == N-1:
    if count%2 == 1:
      ans += 1
#    print(A[i], count, ans)
    
#  elif A[i] == A[i+1]:
#    print(A[i], count, ans)
    
  elif A[i] != A[i+1]:
    if count % 2 == 1:
      ans += 1
#    print(A[i], count, ans)
    count = 0

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

n=int(input())
a=[i for i in range(n)]
print(sum(a))

### FIXED CODE ###

n=int(input())
ans=n*(n-1)//2
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from heapq import heappush, heappop
def min_cost_flow_dijkstra(E, s, t, f):
    INF = 1 << 100
    NN = 2 * N + 6
    LN = NN.bit_length()
    G = [[] for _ in range(NN)]
    for a, b, cap, c in E:
        G[a].append([b, cap, c, len(G[b])])
        G[b].append([a, 0, -c, len(G[a])-1])
    prevv = [-1] * NN
    preve = [-1] * NN
    res = 0
    while f > 0:
        h = [0] * NN
        dist = [INF] * NN
        dist[s] = 0
        Q = []
        heappush(Q, s)
        while len(Q):
            x = heappop(Q)
            d, v = (x>>LN), x % (1<<LN)
            if dist[v] < d: continue
            for i, (w, _cap, c, r) in enumerate(G[v]):
                if _cap > 0 and dist[w] > dist[v] + c + h[v] - h[w]:
                    dist[w] = dist[v] + c + h[v] - h[w]
                    prevv[w] = v
                    preve[w] = i
                    heappush(Q, (dist[w] << LN) + w)
        if dist[t] == INF:
            return -1
        for v in range(N):
            h[v] += dist[v]
        
        d = f
        v = t
        while v != s:
            d = min(d, G[prevv[v]][preve[v]][1])
            v = prevv[v]
        f -= d
        res += d * dist[t]
        v = t
        while v != s:
            G[prevv[v]][preve[v]][1] -= d
            G[v][G[prevv[v]][preve[v]][3]][1] += d
            v = prevv[v]
    return res

E = []
N = int(input())
su = 0
inf = 1 << 31
for i in range(N):
    x, y, cnt = map(int, input().split())
    E.append((2*N+4, i, cnt, 0))
    E.append((i, 2*N, cnt, x + y + inf))
    E.append((i, 2*N+1, cnt, x - y + inf))
    E.append((i, 2*N+2, cnt, - x + y + inf))
    E.append((i, 2*N+3, cnt, - x - y + inf))
    su += cnt

for i in range(N):
    x, y, cnt = map(int, input().split())
    E.append((i+N, 2*N+5, cnt, 0))
    E.append((2*N, i+N, cnt, - x - y + inf))
    E.append((2*N+1, i+N, cnt, - x + y + inf))
    E.append((2*N+2, i+N, cnt, x - y + inf))
    E.append((2*N+3, i+N, cnt, x + y + inf))

print(su * inf * 2 - min_cost_flow_dijkstra(E, 2*N+4, 2*N+5, su))

### FIXED CODE ###

from networkx import*
N = int(input())
G = MultiDiGraph()
for i in range(N):
    x, y, c = map(int, input().split())
    G.add_node(i, demand = -c)
    G.add_weighted_edges_from([(i, -1, x + y)], capacity = c)
    G.add_weighted_edges_from([(i, -2, x - y)], capacity = c)
    G.add_weighted_edges_from([(i, -3, -x + y)], capacity = c)
    G.add_weighted_edges_from([(i, -4, -x - y)], capacity = c)
for i in range(N):
    x, y, c = map(int, input().split())
    G.add_node(N + i, demand = c)
    G.add_weighted_edges_from([(-1, N + i, -x - y)], capacity = c)
    G.add_weighted_edges_from([(-2, N + i, -x + y)], capacity = c)
    G.add_weighted_edges_from([(-3, N + i, x - y)], capacity = c)
    G.add_weighted_edges_from([(-4, N + i, x + y)], capacity = c)

print(-min_cost_flow_cost(G))
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()
l = list([input().split() for _ in range(q)])

for i in l:
    l = int(i[0])
    r = int(i[1])
    print(s[l-1:r].count('AC'))


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)

for i in range(N):
    t[i+1] = t[i] + (1 if S[i: i+2] == 'AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
### BUGGY CODE ###

S=input()
x=0
M=13
MOD=10**9+7
dp=[[0]*M for i in range(2)]
dp[0][0]=1
p=0
for i in range(len(S)):
  s=S[i]
  if s=='?':
    for s in range(10):
      for j,d in enumerate(dp[p%2]):
        dp[(p+1)%2][(10*j+s)%M]+=d
        dp[(p+1)%2][(10*j+s)%M]%=MOD
  else:
    s=int(s)
    for j,d in enumerate(dp[p%2]):
      dp[(p+1)%2][(10*j+s)%M]=d
  dp[p%2]=[0]*13
  p+=1
  p%=2
print(dp[p%2][5]%MOD)


### FIXED CODE ###

S=input()
import numpy as np
M=13
MOD=10**9+7
dp=np.zeros(M, dtype=np.int64)
dp[0]=1
idx = np.zeros(M, dtype=np.int8)
window = np.ones(10, dtype=np.int8)
for i in range(M):
  idx[i * 10 % M] = i
for s in S:
  if s=='?':
    tdp=dp[idx]
    ndp = np.concatenate([tdp[4:], tdp])
    dp = np.convolve(ndp, window, mode='valid') % MOD
  else:
    dp=np.roll(dp[idx],int(s))
print(dp[5]%MOD)
### BUGGY CODE ###

n=int(input())
s=[input() for _ in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    if s[i].count('a')!=s[j].count('a'):
        continue
    if s[i].count('b')!=s[j].count('b'):
        continue
    if s[i].count('c')!=s[j].count('c'):
        continue
    if s[i].count('d')!=s[j].count('d'):
        continue
    if s[i].count('e')!=s[j].count('e'):
        continue
    if s[i].count('f')!=s[j].count('f'):
        continue
    if s[i].count('g')!=s[j].count('g'):
        continue
    if s[i].count('h')!=s[j].count('h'):
        continue
    if s[i].count('i')!=s[j].count('i'):
        continue
    if s[i].count('j')!=s[j].count('j'):
        continue
    if s[i].count('k')!=s[j].count('k'):
        continue
    if s[i].count('l')!=s[j].count('l'):
        continue
    if s[i].count('m')!=s[j].count('m'):
        continue
    if s[i].count('n')!=s[j].count('n'):
        continue
    if s[i].count('o')!=s[j].count('o'):
        continue
    if s[i].count('p')!=s[j].count('p'):
        continue
    if s[i].count('q')!=s[j].count('q'):
        continue
    if s[i].count('r')!=s[j].count('r'):
        continue
    if s[i].count('s')!=s[j].count('s'):
        continue
    if s[i].count('t')!=s[j].count('t'):
        continue
    if s[i].count('u')!=s[j].count('u'):
        continue
    if s[i].count('v')!=s[j].count('v'):
        continue
    if s[i].count('w')!=s[j].count('w'):
        continue
    if s[i].count('x')!=s[j].count('x'):
        continue
    if s[i].count('y')!=s[j].count('y'):
        continue
    if s[i].count('z')!=s[j].count('z'):
        continue
    ans+=1
print(ans)

      

### FIXED CODE ###

n=int(input())
ans=0
dic={}
for _ in range(n):
    s=input()
    s=sorted(s)
    s=''.join(s)
    if not s in dic.keys():
      dic[s]=1
    else: dic[s]+=1
for i in dic.values():
  ans+=i*(i-1)//2


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

n=int(input())
#a=map(int,input().split())
a=(input().split())
#print(a)
a1=[]
for i in range(n):
    a1.append(int(a[i]))
#print(a1)
    
str1=""
for i in range(n):
    for ii in range(n):
        if i+1 == int(a[ii]):
            str1=str1 + " " +str(ii+1)
print(str1)

### FIXED CODE ###

n=int(input())
a=(input().split())
a1={}
for i in range(n):
    a1[(a[i])]=i+1
str1=""
for i in range(n):
    print(str(a1[str(i+1)]),end=" ")
print()
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()

import bisect

ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    temp=[l[k] for k in range(j+1,n) if k!=i and k!=j]
    ind=bisect.bisect_left(temp,abs(l[i]+l[j]))
    ans+=ind
print(ans)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()

import bisect

ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    ind=bisect.bisect_left(l,l[i]+l[j])
    ans+=ind-j-1
print(ans)
### BUGGY CODE ###

h,w=map(int, input().split())
c_h,c_w=map(int, input().split())
d_h,d_w=map(int, input().split())
map=[[-1]*w for i in range(h)]
 
for gyou in range(h):
    tmp=input()
    for retu in range(w):
        if tmp[retu]=="#":map[gyou][retu]=-2
 
genzai=[[c_h-1,c_w-1]]
tugi=[]
 
map[c_h-1][c_w-1]=0
 
def idou(gyou,retu,kaisuu):
    for i in (-1,1):
        if 0<=gyou+i and gyou+i<h:
            if map[gyou+i][retu]>kaisuu or map[gyou+i][retu]==-1:
                map[gyou+i][retu]=kaisuu
                genzai.append([gyou+i,retu])
    for i in (-1,1):
        if 0<=retu+i and retu+i<w:
            if map[gyou][retu+i]>kaisuu or map[gyou][retu+i]==-1:
                map[gyou][retu+i]=kaisuu
                genzai.append([gyou,retu+i])
    
    for i in range(-2,3):
        for j in range(-2,3):
            if 0<=gyou+i and gyou+i<h and 0<=retu+j and retu+j<w:
                if map[gyou+i][retu+j]>kaisuu+1 or map[gyou+i][retu+j]==-1:
                    map[gyou+i][retu+j]=kaisuu+1
                    tugi.append([gyou+i,retu+j])
 
wapu=0
 
import copy
 
while True:
 
    while len(genzai)>0:
        idou(genzai[0][0],genzai[0][1],wapu)
        genzai.pop(0)
    
    if len(genzai)==0:
        if len(tugi)!=0:
            genzai=copy.deepcopy(tugi)
            tugi=[]
            wapu+=1
        else:
            print(map[d_h-1][d_w-1])
            exit()

### FIXED CODE ###

from collections import deque

h,w=map(int, input().split())
c_h,c_w=map(int, input().split())
d_h,d_w=map(int, input().split())
map=[[-1]*w for i in range(h)]
 
for gyou in range(h):
    tmp=input()
    for retu in range(w):
        if tmp[retu]=="#":map[gyou][retu]=-2
 
genzai=deque()
wapu=deque()
genzai.append((c_h-1,c_w-1))
wapu.append((c_h-1,c_w-1))
 
map[c_h-1][c_w-1]=0
 
def idou(gyou,retu,kaisuu):
    wapu.append((gyou,retu))
    for i in (-1,1):
        if 0<=gyou+i and gyou+i<h:
            if map[gyou+i][retu]==-1:
                map[gyou+i][retu]=kaisuu
                genzai.append((gyou+i,retu))
                wapu.append((gyou+i,retu))
                
        if 0<=retu+i and retu+i<w:
            if map[gyou][retu+i]==-1:
                map[gyou][retu+i]=kaisuu
                genzai.append((gyou,retu+i))
                wapu.append((gyou,retu+i))

def idou_wapu(gyou,retu,kaisuu):
    for i in range(-2,3):
        for j in range(-2,3):
            if 0<=gyou+i and gyou+i<h and 0<=retu+j and retu+j<w:
                if map[gyou+i][retu+j]==-1:
                    map[gyou+i][retu+j]=kaisuu+1
                    genzai.append((gyou+i,retu+j))

wapu_kaisuu=0

while len(genzai)!=0:
 
    while len(genzai)>0:
        idou(genzai[0][0],genzai[0][1],wapu_kaisuu)
        genzai.popleft()
    
    while len(wapu)>0:
        idou_wapu(wapu[0][0],wapu[0][1],wapu_kaisuu)
        wapu.popleft()
    
    wapu_kaisuu+=1

    if map[d_h-1][d_w-1]!=-1:
        print(map[d_h-1][d_w-1])
        exit()


print(map[d_h-1][d_w-1])
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
import numpy as np

def solve(N: int, S: str):
    r = []
    g = []
    b = []
 
    for i, x in enumerate(S):
        if x ==  "R":r.append(i)
        elif x =="G":g.append(i)
        else:b.append(i)

    r = np.array(r)
    g = np.array(g)
    b = np.array(b)
  
    sb = set(b)
    ans = 0
    for r_ in r:
        # rg
        for g_ in g[g>r_]:
            # rgb
            if (g_ + (g_ - r_)) in sb:
                ans -= 1
            # brg
            if (r_ - (g_ - r_)) in sb:
                ans -= 1
            # rbg
            if ((r_ + g_)/2) in sb:
                ans -= 1
            ans += len(b)

        # gr
        for g_ in g[g<r_]:
            # grb
            if (r_ + (r_ - g_)) in sb:
                ans -= 1
            # bgr
            if (g_ - (r_ - g_)) in sb:
                ans -= 1
            # gbr
            if ((r_ + g_)/2) in sb:
                ans -= 1
            ans += len(b)
    print(ans)
  
    return
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)
 
if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque

def solve(N: int, S: str):
    r = []
    g = []
    b = []
    rp = 0
    gp = 0
    bp = 0

    rsum = [0]*(N+1)
    bsum = [0]*(N+1)
    gsum = [0]*(N+1)

    for i, x in enumerate(S[::-1]):
        if x ==  "R":
            r.append(i)
            rp = 1
        elif x =="G":
            g.append(i)
            gp = 1
        else:
            b.append(i)
            bp = 1
        rsum[N-1-i] = rsum[N-1-i+1] + rp
        gsum[N-1-i] = gsum[N-1-i+1] + gp
        bsum[N-1-i] = bsum[N-1-i+1] + bp
        rp = 0
        gp = 0
        bp = 0
    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            if S[i] != S[j]:
                if j+j-i<N: k = S[j+j-i]
                else: k = ""
                if (S[i] == "R" and S[j] == "B") or (S[j] == "R" and S[i] == "B"):
                    ans += gsum[j] - (k=="G")*1
                elif (S[i] == "R" and S[j] == "G") or (S[j] == "R" and S[i] == "G"):
                    ans += bsum[j] - (k=="B")*1
                elif (S[i] == "G" and S[j] == "B") or (S[j] == "G" and S[i] == "B"):
                    ans += rsum[j] - (k=="R")*1
    

    print(ans)
  
    return
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)
 
if __name__ == '__main__':
    main()
### BUGGY CODE ###

from math import sqrt
h = {1: 'COUNTER_CLOCKWISE',
       2: 'CLOCKWISE',
       3: 'ONLINE_BACK',
       4: 'ONLINE_FRONT',
       5: 'ON_SEGMENT',}

def dot(a, b):
    return sum([i * j for i,j in zip(a, b)])

def sub(a, b):
    return [a[0] - b[0],a[1] - b[1]]

def cross(a, b):
    return  a[0] * b[1] - a[1] * b[0]

def _abs(a):
    return sqrt(a[0] ** 2 + a[1] ** 2)

def ccw(a, b, c):
    x = sub(b, a)
    y = sub(c, a)
    if cross(x, y) > 0: return 1
    if cross(x, y) < 0: return 2
    if dot(x, y) < 0: return 3
    if _abs(x) < _abs(y): return 4
    return 5

def CCW(a,b,c):
    return h[ccw(a,b,c)]

n = int(input())
c = [list(map(int, input().split())) for i in range(n)]
c.sort(key=lambda x: (x[0], x[1]))
U = c[:2]

for i in range(2, n):
    j = len(U)
    while j >= 2 and CCW(U[-1],U[-2],c[i])  == "COUNTER_CLOCKWISE":
        U.pop()
        j -= 1
    U.append(c[i])

c = c[::-1]
L = c[:2]

for i in range(2, n):
    j = len(L)
    while j >= 2 and CCW(L[-1], L[-2], c[i])  == "COUNTER_CLOCKWISE":
        L.pop()
        j -= 1
    L.append(c[i])

ans = []
for x,y in U:
    ans.append([x,y])
for x, y in L:
    if not [x,y] in U:
        ans.append([x,y])
print(len(ans))

first = sorted(ans,key=lambda x: (x[1], x[0]))[0]
i = ans.index(first)
for x,y in ans[i:] + ans[:i]:
    print(x, y)


### FIXED CODE ###

from math import sqrt
from collections import deque

def sub(a, b):
    return [a[0] - b[0],a[1] - b[1]]

def cross(a, b):
    return  a[0] * b[1] - a[1] * b[0]

def ccw(a, b, c):
    x = sub(b, a)
    y = sub(c, a)
    return cross(x, y) > 0

n = int(input())
c = [list(map(int, input().split())) for i in range(n)]
c.sort(key=lambda x: (x[0], x[1]))
U = deque(c[:2])

for i in range(2, n):
    j = len(U)
    while j >= 2 and ccw(U[-1],U[-2],c[i]):
        U.pop()
        j -= 1
    U.append(c[i])

c = c[::-1]
L = deque(c[:2])

for i in range(2, n):
    j = len(L)
    while j >= 2 and ccw(L[-1], L[-2], c[i]):
        L.pop()
        j -= 1
    L.append(c[i])

ans = U
for i in range(1,len(L)-1):
    x, y = L[i]
    ans.append([x,y])

print(len(ans))
i = ans.index(sorted(ans, key=lambda x: (x[1],x[0]))[0])
ans = list(ans)
for x,y in ans[i:] + ans[:i]:
    print(x, y)
### BUGGY CODE ###

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

count = 0
for a in range(1, N+1):
    b = K - a % K
    while b <= N:
        if (a % K) == (b % K):
            c = K - a % K
            count += (N - c) // K + 1
        b += K

print(count)


### FIXED CODE ###

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

count = 0
for a in range(1, N+1):
    b = K - a % K
    if (a % K) == (b % K):
        count += ((N - b) // K + 1) ** 2

print(count)
### BUGGY CODE ###

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

for i in range(1,N+1):
    print(A.index(i)+1,end=" ")

### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))

ans = [0] * N
for k,v in enumerate(A):
    ans[v-1] = k+1

for i in range(N):
    print(ans[i],end=" ")