Harryxun/stf_run huggingface dataset:
N = int(input())
S = list(input())

pattern = set()

def generate_pwd(cnt, lucky_num):
    if len(lucky_num) == 3:
        pattern.add(''.join(lucky_num))
        return
    if cnt > 3:
        return
    
    generate_pwd(cnt, lucky_num[:cnt] + lucky_num[cnt + 1:])
    generate_pwd(cnt + 1, lucky_num)

    return

generate_pwd(0, S)
print(len(pattern))
        


### FIXED CODE ###

N = int(input())
S = list(input())

ans = 0

for n in range(1000):
    pin = str(n).zfill(3)
    head = 0
    for c in S:
        if c == pin[head]:
            head += 1
        if head == 3:
            ans += 1
            break

print(ans)
N = int(input())
H = list(map(int,input().split()))
C = [0] * (N - 1)

for i in range(N - 1):
	if H[i + 1] <= H[i]:
		C[i] = 1

for i in range(N-2):
	if 0 < C[i + 1]:
		C[i + 1] = C[i] + C[i + 1]

print(max(C))

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
count = 0
answer = 0

for i in range(N - 1):
	if H[i + 1] <= H[i]:
		count = count + 1
	else:
		if answer < count:
			answer = count
			count = 0
		else:
			count = 0

if answer < count:
	answer = count
	
print(answer)
from collections import deque

H,W = list(map(int, input().split()))
S = [input() for _ in range(H)]
dist = [[0] * W for i in range(H)]
dist[0][0] = 1

whites = 0
for s in S:
    for w in s:
        if w == ".":
            whites += 1

# Pythonの再帰はおっっそい. 再帰が今回のケースだと使いにくい(探索打ち切り)
def BFS(cur):
    #global dist
    x_path = [-1,0,1,0]
    y_path = [0,-1,0,1]

    q = deque()
    q.append(cur)
    while True:
        cur = q.popleft()
        if cur == (H,W):
            break

        for x,y in zip(x_path, y_path):
            nex = (cur[0] + x, cur[1] + y)
            if nex[0] < 1 or nex[0] > H or nex[1] < 1 or nex[1] > W:
                continue
            if S[nex[0]-1][nex[1]-1] == "#":
                continue
            if dist[nex[0]-1][nex[1]-1] > 0:
                continue

            dist[nex[0]-1][nex[1]-1] = dist[cur[0]-1][cur[1]-1] + 1 
            q.append(nex)


BFS((1,1))

print(whites - dist[H-1][W-1])


### FIXED CODE ###

from collections import deque

H,W = list(map(int, input().split()))
S = [input() for _ in range(H)]
dist = [[0] * W for i in range(H)]
dist[0][0] = 1

whites = 0
for s in S:
    for w in s:
        if w == ".":
            whites += 1

# Pythonの再帰はおっっそい. 再帰が今回のケースだと使いにくい(探索打ち切り)
def BFS(cur):
    #global dist
    x_path = [-1,0,1,0]
    y_path = [0,-1,0,1]

    q = deque()
    q.append(cur)
    while True:
        if len(q) == 0:
            break
        cur = q.popleft()
        if cur == (H,W):
            break

        for x,y in zip(x_path, y_path):
            nex = (cur[0] + x, cur[1] + y)
            if nex[0] < 1 or nex[0] > H or nex[1] < 1 or nex[1] > W:
                continue
            if S[nex[0]-1][nex[1]-1] == "#":
                continue
            if dist[nex[0]-1][nex[1]-1] > 0:
                continue

            dist[nex[0]-1][nex[1]-1] = dist[cur[0]-1][cur[1]-1] + 1 
            q.append(nex)


BFS((1,1))
if dist[H-1][W-1] == 0:
    print(-1)
else:
    print(whites - dist[H-1][W-1])
N = int(input())
nums = list(map(int, input().split()))
total, ano = sum(nums), 0
last_dif = 100000000
for i in range(len(nums)-1):
    total -= nums[i]
    ano += nums[i]    
    if abs(ano-total) < last_dif:
        dif = abs(ano-total)
        last_dif = dif
print(dif)
    

### FIXED CODE ###

N = int(input())
nums = list(map(int, input().split()))
total, ano = sum(nums), 0
last_dif = 100000000000000
for i in range(len(nums)-1):
    total -= nums[i]
    ano += nums[i]    
    if abs(ano-total) < last_dif:
        dif = abs(ano-total)
        last_dif = dif
print(dif)
l = list()
original_list = list()
n = int(input())
original_list = list(range(1,n))
for x in original_list:
      ans = 0
      while x % 2 == 0:
        x = x / 2
        ans = ans + 1
      l.append(ans)
 
print(max(l))


### FIXED CODE ###

l = list()
n = int(input())
original_list = list(range(1,n+1))
for x in original_list:
      ans = 0
      while x % 2 == 0:
        x = x / 2
        ans = ans + 1
      l.append(ans)

a = l.index(max(l))
print(original_list[a])
S=input()
h=S/3600
m=(S%3600)/60
s=S%60
print("%d:%d:%d" % (h,m,s))

### FIXED CODE ###

t=int(input())
h=t//3600
m=(t%3600)//60
s=t-h*3600-m*60
print('{}:{}:{}'.format(h,m,s))
n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))

sorted(nums)
min_num = -1
max_num = -1

# 最大値
ans_right = nums.pop()
# 最小値
ans_left = nums.pop(0
ans = abs(ans_right - ans_left)

while len(nums) > 2:
    num_max = nums[-1]
    num_min = nums[0]
    compare = [
        abs(num_max-ans_right),
        abs(num_max-ans_left),
        abs(num_min-ans_right),
        abs(num_min-ans_left)
    ]
    t = max(compare)
    c = compare.index(t)

    # 追加処理
    ans += t
    add_to_ans = num_max if c == 0 else num_min
    nums.remove(add_to_ans)
    if c % 2 == 0:
        ans_right = add_to_ans
    else:
        ans_left = add_to_ans

# add len(nums) == 1
print(ans + max(abs(nums[0]-ans_right),abs(nums[0]-ans_left)))

### FIXED CODE ###

n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))

nums.sort()
# 奇数は2通り
# w型とm型
if n % 2 == 1:
    w = -2*sum(nums[:n//2])+nums[n//2]+nums[n//2+1]+2*sum(nums[n//2+2:])
    m = -2*sum(nums[:n//2-1])-nums[n//2-1]-nums[n//2]+2*sum(nums[n//2+1:])
    print(max(w,m))
# 偶数は1通り
else:
    print(-2*sum(nums[:n//2-1])-nums[n//2-1]+nums[n//2]+2*sum(nums[n//2+1:]))
N = int(input())
d = [input().split() for i in range(N)]
print(len(set(d)))

### FIXED CODE ###

N = int(input())
d = [input() for i in range(N)]
print(len(set(d)))
a,b=map(int, input().split())
if (a<=9 && b<=9):
  print(a*b)
else:
  print("-1")


### FIXED CODE ###

a,b=map(int, input().split())
if (a<=9 and b<=9):
  print(a*b)
else:
  print("-1")
N = [int(x) for x in input()]
print(max(sum(N), N[0]-1+9*len(N))

### FIXED CODE ###

N_list = [int (i) for i in list(input())]
digit = 0
dflag = False
max = 0
for i in N_list:
    max += i

for i in N_list:
    if i == 9:
        dflag = True
    else:
        break

    digit += 1

if dflag:
    N_list[digit-1] -=1
    for i in range(digit, len(N_list)):
        N_list[i] = 9

else:
    N_list[digit] -=1
    for i in range(digit+1, len(N_list)):
        N_list[i] = 9

sum = 0

for i in N_list:
    sum += i

if sum > max:
    max = sum
print (max)
def get_n():
    return int(input())
def get_ns():
    return [int(a) for a in input().split()]
import math
def main():
    n = get_n()
    ns = sorted(set([get_n() for _ in range(n)]))
    top3 = [9999999999,9999999999,9999999999]
    for i,a in enumerate(ns):
        for j,b in enumerate(ns):
            if i==j:
                continue
            keta = int(math.log10(b))+1
            c = a*pow(10,keta)+b
            if c <top3[2]:
                top3 = sorted(top3+[c])[:-1]
    print(top3[2])





if __name__ == '__main__':
    main()



### FIXED CODE ###

def get_n():
    return int(input())
def get_ns():
    return [int(a) for a in input().split()]
import math
def main():
    n = get_n()
    ns = sorted(set([get_n() for _ in range(n)]))[:100]
    top3 = [9999999999,9999999999,9999999999]
    for i,a in enumerate(ns):
        for j,b in enumerate(ns):
            if i==j:
                continue
            keta = int(math.log10(b))+1
            c = a*pow(10,keta)+b
            if c <top3[2]:
                top3 = sorted(top3+[c])[:-1]
    print(top3[2])





if __name__ == '__main__':
    main()
N=int(input())
a=input().split()
alice=0
bob=0
while len(a) !=0:
  alice+=max(a)
  a.remove(max(a))
  bob+==max(a)
  a.remove(max(a))
print(alice-bob)

### FIXED CODE ###

N=int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
S=0
for i in range(N):
  if i%2==0:
    S+=a[i]
  else:
    S-=a[i]
print(S)
a,b = map(input().split())
ast = a * int(b)
bst = b * int(a)
print(ast if ast < bst else bst)

### FIXED CODE ###

a,b = input().split()
ast = a * int(b)
bst = b * int(a)
print(ast if ast < bst else bst)
S = str(input())
if S = "SUN":
    print(7)
if S = "MON":
    print(6)
if S = "TUE":
    print(5)
if S = "WED":
    print(4)
if S = "THU":
    print(3)
if S = "FRI":
    print(2)
if S = "SAT":
    print(1)


### FIXED CODE ###

S = str(input())
if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
else :
    print(1)
N, A, B = map(int, input().split())
if N*A > B:
  print(B)
else:
  print(N*A

### FIXED CODE ###

N, A, B = map(int, input().split())
if N*A > B:
  print(B)
else:
  print(N*A)
import random as ra
import copy
import time

start_time = time.time()

D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]

### 得点計算用
#t = [int(input()) for i in range(D)]
def cal_point(t):
    score = 0
    last = [0]*26
    for d in range(D):
        score += s[d][t[d]-1]
        last[t[d]-1] = d+1
        for i in range(26):
            score -= c[i]*(d+1-last[i])
    #print(score)
    return score


t = []
last = [0]*26
for i in range(D):
    opt1 = s[i].index(max(s[i]))+1
    opt2 = last.index(min(last))+1
    if ra.random()<0.5:
        t.append(opt1)
        last[opt1] = i+1
    else:
        t.append(opt2)
        last[opt2] = i+1


#t = [ra.randint(1,26) for i in range(D)]
max_score = 0
optimal_t = copy.deepcopy(t)
#M = 10**5
while (time.time()-start_time)<1.95:
#for i in range(M):
    d = ra.randint(1,D)
    q = ra.randint(1,26)
    td = t[d-1]
    t[d-1] = q
    now = cal_point(t)
    if now > max_score:
        optimal_t = copy.deepcopy(t)
        max_score = now
    else:
        t[d-1] = td

print(*optimal_t,sep='\n')


### FIXED CODE ###

import random as ra
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]
for i in range(D):
    print(ra.randint(1,26))
L=list(map(int,input().split()))
table=[5,5,7]
L=soretd(L)
if table == L:
  print("YES")
else:
  print("NO")


### FIXED CODE ###

L=list(map(int,input().split()))
table=[5,5,7]
L=sorted(L)
if table == L:
  print("YES")
else:
  print("NO")
#!/usr/bin/env python

N = 1
a = []

def sol(x, cnt) : 

    cnt+=1
    if a[x-1] == 2 :
        return cnt
    if cnt > N :
        return -1

    return sol(a[x-1], cnt)


if __name__ == '__main__' : 
    N = int(input())

    for i in range(N) : 
        a.append(int(input()))

    print( sol(1,0) )




### FIXED CODE ###

#!/usr/bin/env python

import sys
sys.setrecursionlimit(1000000)

N = 1
a = []

def sol(x, cnt) : 
    cnt+=1
    if a[x-1] == 2 :
        return cnt
    if cnt > N :
        return -1

    return sol(a[x-1], cnt)


if __name__ == '__main__' : 
    N = int(input())

    for i in range(N) : 
        a.append(int(input()))

    print( sol(1,0) )
s = input()
t = ""
count += 0
for i in range(len(s)):
  if i == 0:
    t += s[i]
  elif i == len(s) - 1:
    t += s[i]
  else:
    count += 1
    if i == len(s) - 2:
      t += str(count)
print(t)

### FIXED CODE ###

s = input()
t = ""
count = 0
for i in range(len(s)):
  if i == 0:
    t += s[i]
  elif i == len(s) - 1:
    t += s[i]
  else:
    count += 1
    if i == len(s) - 2:
      t += str(count)
print(t)
N, M = [int(s) for s in input().split()]
b = [0]*N
for _ in range(M):
    b[int(input().strip())-1] = 1

a = [0]*N

if b[0] == 0:
    a[0] = 1
if b[1] == 0:
    a[1] = 1 + a[0]

for i in range(2, N):
    if b[i] == 0:
        a[i] = a[i-1] + a[i-2]
print(a[-1]%1000000007)

### FIXED CODE ###

MOD = (10**9 + 7)

     
line = [int(s) for s in input().split()]
     
N, M = line[0], line[1]
     
b = [0]*(N+1)
for i in range(M):
    step_num = int(input().split()[0])
    b[step_num] = 1
        
        
dp = [0]*(N+1)
dp[0] = 1
if b[1] == 1:
    dp[1] = 0
else:
    dp[1] = 1
     
for i in range(2, N+1):
    if b[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-1]+dp[i-2])%MOD
print(dp[N])
S = input()
N = len(S)

alp = 'ACGT'

cnt = []

for i in range(0, N):
    for j in range(i, N+1):
        tmp = S[i:j]
        flg = 0
        for a in alp:
            if a in tmp:
                flg = 1
        if flg:
            cnt.append(len(tmp))

print(max(cnt))


### FIXED CODE ###

S = input()
N = len(S)

alp = 'BDEFHIJKLMNOPQRSUVWXYZ'

ans = []
cnt = []

for i in range(0, N):
    for j in range(i, N+1):
        tmp = S[i:j]
        flg = 1
        for a in alp:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))

print(max(cnt))
A, B, H, M = map(float, input().split())

import math
PI = math.pi
radA = (2.0 * PI * (H + M / 60.0)) / 12.0
radB = (2.0 * PI * M) / 60.0
print(math.hypot(A * math.cos(radA) - B * math.cos(radB),
                 A * math.sin(radA) - B * math.sin(radB))

### FIXED CODE ###

import math

A, B, H, M = map(int, input().split())

degA = H * 30 + M * 0.5
degB = M * 6
deg = math.radians(degA-degB)
print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(deg)))
w=input()
w1=input()
num=len(w)
num1=len(w1)
start=-1
if num<num1:
  b1=False
for i in range(num-num1+1):
  b=True
  for j in range(num1):
    if w[i+j]=="?" or w[i+j]==w1[j]:
      pass
    else:
      b=False
  if b:
      start=i
if start==-1:
  print("UNRESTORABLE")
else:
  word=""
  if start!=0:
    for i in range(num):
      if i<start:
        if w[i]=="?":
          word+="a"
        else:
          word+=w[i]
      elif start<=i and i<=start+num1-1:
        word+=w1[i]
      else:
        if w[i]=="?":
          word+="a"
        else:
          word+=w[i]
  print(word)


### FIXED CODE ###

w=input()
w1=input()
num=len(w)
num1=len(w1)
start=-1
if num<num1:
  b1=False
for i in range(num-num1+1):
  b=True
  for j in range(num1):
    if w[i+j]=="?" or w[i+j]==w1[j]:
      pass
    else:
      b=False
  if b:
      start=i
if start==-1:
  print("UNRESTORABLE")
else:
  word=""
  for i in range(num):
    if i<start:
      if w[i]=="?":
        word+="a"
      else:
        word+=w[i]
    elif start<=i and i<=start+num1-1:
      word+=w1[i-start]
    else:
      if w[i]=="?":
        word+="a"
      else:
        word+=w[i]
  print(word)
a,b = input()


seki = int(a)*int(b)
print(seki)

### FIXED CODE ###

ab = input( )

ab = ab.split()
print(int(ab[1])*int(ab[0]))
def main():
  N = int(input())
  li = list(map(int, input().split()))

  num_of_operation = 0
  
  while True:
    for num in li:
      if num % 2 == 1:
        break
    
    for i in xrange(N):
      li[i] /= 2
    num_of_operation += 1
  
  print(num_of_operation)

if __name__ == '__main__':
  main()


### FIXED CODE ###

def main():
    N = int(input())
    li = list(map(int, input().split()))

    num_of_operation = 0
    is_dividable = True

    while True:
        for num in li:
            if num % 2 != 0:
                is_dividable = False
                break

        if not is_dividable:
            break

        for i in range(N):
            li[i] //= 2
        num_of_operation += 1

    print(num_of_operation)


if __name__ == '__main__':
    main()
N,M=map(int,input().split())
A=[[]]
for i in range(N):
    A.append(list(map(int,input().split())))
A.sort(key=lambda x:(x[0],x[1]))
C=[A[0][0]*A[0][1]]
D=A[0][1]
for i in range(N-1):
    C.append(C[i]+A[i+1][0]*A[i+1][1])
    D.append(D[i]+A[i+1][1])
for i in range(N):
    if M<D[i]:
        print(C[i]-(D[i]-M)*A[i][0])

### FIXED CODE ###

N,M=map(int,input().split())
A=[]
for i in range(N):
    A.append(list(map(int,input().split())))
A.sort(key=lambda x:(x[0],x[1]))
C=[A[0][0]*A[0][1]]
D=[A[0][1]]
for i in range(N-1):
    C.append(C[i]+A[i+1][0]*A[i+1][1])
    D.append(D[i]+A[i+1][1])
for i in range(N):
    if M<D[i]:
        print(C[i]-(D[i]-M)*A[i][0])
        break
if M==D[N-1]:
    print(C[N-1])
import math
import sys
sys.setrecursionlimit(10000000)

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

up = math.sqrt(n)

def colsum(num, base):
    if num < base:
        return num
    else:
        return num%base + colsum(num//base,base)

#s = n(n<b)
if s == n:
    print(n+1)
    exit()

#s > n
if s > n:
    print(-1)
    exit()


#sqrt(n)まで探索
for i in range(2,int(up)+1):
    if s == colsum(n,i):
        print(i)
        exit()

#2桁しかあり得ない場合(sqrt(n)<b<n)
for j in range(1,int(up)+1):
    b = int((n-s)/j) + 1
    if s == colsum(n,b) and b > 1:
        print(i)
        exit()

print(-1)

### FIXED CODE ###

import math
import sys

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

up = math.sqrt(n)

def colsum(num, base):
    if num < base:
        return num
    else:
        return num%base + colsum(num//base,base)

#s >= n
if s == n:
    print(n+1)
elif s > n:
    print(-1)
else:
    #sqrt(n)まで探索
    for i in range(2,int(up)+1):
        if colsum(n,i) == s:
            print(i)
            sys.exit()

    #2桁しかあり得ない場合(sqrt(n)<b<n)
    for j in range(int(up),0,-1):
        if (n-s)%j == 0:
            b = (n-s)/j + 1
            if colsum(n,b) == s and b > 1:
                print(int(b))
                sys.exit()

    print(-1)
from operator import itemgetter, attrgetter
#input
n = int(input())
H = []
for i in range(n):
    a, b = map(int, input().split())
    H.append([i, a, b])

C = sorted(H, key = itemgetter(1, 2), reverse = True)
A = sorted(H, key = itemgetter(2, 1), reverse = True)
 
ans_c = 0
ans_a = 0
turn = 0
 
while H != []:
    C = sorted(H, key = itemgetter(1, 2), reverse = True)
    A = sorted(H, key = itemgetter(2, 1), reverse = True)
    if turn % 2 == 0: #chokudai 
        if C[0][1] - A[0][1] >= A[0][2] - C[0][2]:
            chokudai = C.pop(0)
        else:
            chokudai = A.pop(0)
        ans_c += chokudai[1]
        H.pop(chokudai[0])
    else: #aoki
        if A[0][2] - C[0][2] >= C[0][1] - A[0][1]:
            aoki = A.pop(0)
        else:
            aoki = C.pop(0)
        ans_a += aoki[2]
        H.pop(aoki[0])
    turn += 1
 
print(ans_c - ans_a)


### FIXED CODE ###

#input
n = int(input())
H = []
for _ in range(n):
    a, b = map(int, input().split())
    H.append([a + b, a, b])

H = sorted(H, reverse = True)
sum_c = 0
sum_a = 0

for i in range(n):
    if i % 2 == 0:
        sum_c += H[i][1]
    else:
        sum_a += H[i][2]

ans = sum_c - sum_a
print(ans)
N = int(input())

for i in range(N+1):
    if i == 0:
        L_1 = 2
    elif i == 1:
        L_2 = 1
    else:
        L_3 = L_1 + L_2
        L_1 = L_2
        L_2 = L_3
        
print(L_3)

### FIXED CODE ###

N = int(input())

if N == 1:
  print(1)
  exit()

for i in range(N+1):
    if i == 0:
        L_0 = 2
    elif i == 1:
        L_1 = 1
    else:
        L_2 = L_0 + L_1
        L_0 = L_1
        L_1 = L_2
        
print(L_2)
import math
A,B,K=map(int,input().split())
d=[]
if math.gcd(A,B)==1:
    d.append(1)
else:
    for i in range(2,math.gcd(A,B)+1):
        if A%i==0 and B%i==0:
            d.append(i)
print(d[len(d)-K])

### FIXED CODE ###

import math
A,B,K=map(int,input().split())
d=[]
for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        d.append(i)
print(d[len(d)-K])
from math import sqrt
def main():
    n = int(input())
    ans = 0
    for i in range(1, int(sqrt(n))+1):
        y = n - i
        if y % i == 0 and n//(y//i) == i:
            ans += y // i
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from math import sqrt
def main():
    n = int(input())
    ans = 0
    for i in range(1, int(sqrt(n))+1):
        y = n - i
        if y % i == 0 and y != 0 and n//(y//i) == i:
            ans += y // i
    print(ans)

if __name__ == "__main__":
    main()
N, Q = map(int, input().split())
s = str(input())
s_inv = s[::-1]
coms = [list(map(str, input().split())) for _ in range(Q)]
# 後ろから見る
coms = coms[::-1]
i = 0
j = 0
for com in coms:
    # Rに対する処理
    if com[1] == 'R' and com[0] == s_inv[i]:
        if i <= N-1:
            i = i+1
    # Lに対する処理
    elif com[1] == 'L' and com[0] == s[j]:
        if j <= N-1:
            j = j+1
print(max(N-i-j, 0))

### FIXED CODE ###

N, Q = map(int, input().split())
s = str(input())
coms = [list(map(str, input().split())) for _ in range(Q)]


def isOK(A, index, coms, c):
    # シミュレーションを行う
    for com in coms:
        if com[0] == A[index]:
            if com[1] == 'R':
                index += 1
                if index == len(A):
                    return c == 'R'
            elif com[1] == 'L':
                index -= 1
                if index == -1:
                    return c == 'L'
    return False


def lower_bound(A, coms):
    ng = -1
    ok = len(A)

    while(abs(ok-ng) > 1):
        mid = (ok + ng) // 2

        if isOK(A, mid, coms, 'R'):
            ok = mid
        else:
            ng = mid
    return ok


def upper_bound(A, coms):
    ng = len(A)
    ok = -1

    while(abs(ok-ng) > 1):
        mid = (ok + ng) // 2

        if isOK(A, mid, coms, 'L'):
            ok = mid
        else:
            ng = mid
    return ok


lower = lower_bound(s, coms)
upper = upper_bound(s, coms)
print(lower-upper-1)
N = int(input())
a = list(map(int,input().split()))
a.sort()
flag = True
if len(set(a)) == 1 and a[0] == 0:
    #print('Yes')
elif N % 3 == 0:
    if len(set(a)) == 3:
        c = []
        for i in list(set(a)):
            c.append(a.count(i))
        if a[0] != 0 and c[0] == c[1] and  c[1] == c[2] and c[2] == N//3:
            #print('Yes')
        else:
            #print('No')
            flag = False
    elif len(set(a)) == 2:
        if a[0] == 0 and a.count(a[0])*2 == a.count(a[N-1]) and a.count(a[N-1]) == N//3*2:
            #print('Yes')
        else:
            #print('No')
            flag = False
    else:
        #print('No')
        flag = False
else:
    #print('No')
    flag = False
if flag:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
a.sort()
flag = True
if len(set(a)) == 1 and a[0] == 0:
    #print('Yes')
    pass
elif N % 3 == 0:
    if len(set(a)) == 3:
        b = list(set(a))
        c = []
        for i in b:
            c.append(a.count(i))
        if a[0] != 0 and c[0] == c[1] and  c[1] == c[2] and c[2] == N//3 and b[0]^b[1]^b[2] == 0:
            #print('Yes')
            pass
        else:
            #print('No')
            flag = False
    elif len(set(a)) == 2:
        if a[0] == 0 and a.count(a[0])*2 == a.count(a[N-1]) and a.count(a[N-1]) == N//3*2:
            #print('Yes')
            pass
        else:
            #print('No')
            flag = False
    else:
        #print('No')
        flag = False
else:
    #print('No')
    flag = False
if flag:
    print('Yes')
else:
    print('No')
n = int(input())

arr = [int(a) for a in input().split()]

max_mod = 0
for i in range(1, max(arr)):

    cur_mod = 0
    for a in arr:
        cur_mod += i % a

    max_mod = max(max_mod, cur_mod)

print(max_mod)



### FIXED CODE ###

tasks = input()

tasks = [int(t) for t in tasks.split()]

# 0, 1, 2
cost0 = abs(tasks[1] - tasks[0]) + abs(tasks[2] - tasks[1])

# 0, 2, 1
cost1 = abs(tasks[2] - tasks[0]) + abs(tasks[2] - tasks[1])

# 1, 0, 2
cost2 = abs(tasks[1] - tasks[0]) + abs(tasks[2] - tasks[0])

# 1, 2, 0
cost3 = abs(tasks[1] - tasks[2]) + abs(tasks[2] - tasks[0])

# 2, 0, 1
cost4 = abs(tasks[2] - tasks[0]) + abs(tasks[0] - tasks[1])

# 2, 1, 0
cost5 = abs(tasks[2] - tasks[1]) + abs(tasks[0] - tasks[1])

min_cost = min([cost0, cost1, cost2, cost3, cost4, cost5])

print(min_cost)
N = int(input())
sticks = list(map(int, input().split()))
s_dict = {}
for stick in sticks:
  if stick in s_dict:
    s_dict[stick] += 1
  else:
    s_dict[stick] = 1
sorted_dict = sorted(s_dict.items(), key=lambda:-x[0])
side1 = 0
side2 = 0
for elem in sorted_dict:
  if elem[1] >= 4:
    side1 = side2 = elem[0]
  elif elem[1] == 2 or elem[1] == 3:
    if side1 == 0:
      side1 = elem[0]
    else:
      side2 = elem[0]
  if side1 != 0 and side2 != 0:
    print(side1*side2)
    exit()
print(0)

### FIXED CODE ###

N = int(input())
sticks = list(map(int, input().split()))
s_dict = {}
for stick in sticks:
  if stick in s_dict:
    s_dict[stick] += 1
  else:
    s_dict[stick] = 1
sorted_dict = sorted(s_dict.items(), key=lambda x:-x[0])
side1 = 0
side2 = 0
for elem in sorted_dict:
  if elem[1] >= 4:
    if side1 == 0:
      side1 = side2 = elem[0]
    else:
      side2 = elem[0]
  elif elem[1] == 2 or elem[1] == 3:
    if side1 == 0:
      side1 = elem[0]
    else:
      side2 = elem[0]
  if side1 != 0 and side2 != 0:
    print(side1*side2)
    exit()
print(0)