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

from collections import deque
n= int(input())
tab = [[0 for _ in range(n)] for _ in range(n)]
branchdict = {}
for i in range(n-1):
    a,b,c= map(int,input().split())
    tab[a-1][b-1] = c
    tab[b-1][a-1] = c
    branchdict[a-1] = branchdict.get(a-1,[]) + [b-1]
    branchdict[b-1] = branchdict.get(b-1,[]) + [a-1]
q,k= map(int,input().split())
start = k-1
que = deque()
que.append(start)
passed = set()
passed.add(start)
cost = [0] * n
while len(que)!=0:
    node = que.pop()
    for abr in branchdict[node]:
        if not abr in passed:
            cost[abr] = cost[node] + tab[node][abr]
            passed.add(abr)
            que.append(abr)
for i in range(q):
    x,y= map(int,input().split())
    print(cost[x-1]+cost[y-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n= int(input())
bd = [[] for _ in range(n)]
for i in range(n-1):
    a,b,c= map(int,input().split())
    bd[a-1].append((b-1,c))
    bd[b-1].append((a-1,c))
q,k= map(int,input().split())
cost = [0] * n
def dfs(curnode,pre,addcost):
    for abr in bd[curnode]:
        if abr[0]!=pre:
            cost[abr[0]]=addcost+abr[1]
            dfs(abr[0],curnode,addcost+abr[1])
dfs(k-1,-1,0)
for i in range(q):
    x,y= map(int,input().split())
    print(cost[x-1]+cost[y-1])
### BUGGY CODE ###

N = int(input())

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

B = [0]*N

for i in A:
    B[i-1] = A.index(i)+1

for i in B:
    print(i,end=" ")

### FIXED CODE ###

N = int(input())

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

B = [0]*N

for i in range(N):
    B[A[i]-1] = i+1

print(*B)
### BUGGY CODE ###

N, K = map(int, input().split())
towns = list(map(int, input().split()))
towns.insert(0, -1)
p = 1
tmp_move, first_move, roop_move = [1], [], []
res = -1

while True:
    if towns[p] in tmp_move:
        roop_move = tmp_move[tmp_move.index(towns[p]):]
        first_move = tmp_move[:tmp_move.index(towns[p])]
        break
    else:
        tmp_move.append(towns[p])
        p = towns[p]

if K < len(first_move):
    res = first_move[K]
else:
    index = (K - len(first_move)) % len(roop_move)
    res = roop_move[index]

print(res)

### FIXED CODE ###

N, K = map(int, input().split())
towns = list(map(int, input().split()))
towns.insert(0, -1)
p = 1
tmp_move, first_move, roop_move = [1], [], []
visited = [False for _ in range(N + 1)]
res = -1

while not visited[p]:
    visited[p] = True
    tmp_move.append(towns[p])
    p = towns[p]

index = tmp_move.index(p)
roop_move = tmp_move[index:-1]
first_move = tmp_move[:index]

if K < len(first_move):
    res = first_move[K]
else:
    index = (K - len(first_move)) % len(roop_move)
    res = roop_move[index]

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

import sys
def main():
    N = int(sys.stdin.readline())
    A = [int(sys.stdin.readline()) for i in range(N)]
    maxa = max(A)
    if A.count(maxa) > 1:
        for i in range(N):
            print(maxa)
    else:
        for i in range(N):
            if i != A.index(maxa):
                print(maxa)
            else:
                print(sorted(A)[-2])
                
main()

### FIXED CODE ###

import sys
def main():
    N = int(sys.stdin.readline())
    A = [int(sys.stdin.readline()) for i in range(N)]
    maxa = max(A)
    maxb = sorted(A)[-2]
    if A.count(maxa) > 1:
        for i in range(N):
            print(maxa)
    else:
        for i in range(N):
            if A[i] != maxa:
                print(maxa)
            else:
                print(maxb)
                
main()
### BUGGY CODE ###

def to_bin(number):
    return bin(number)[2:].zfill(45)


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

a_bin = bin(A)[2:].zfill(45)
b_bin = bin(B)[2:].zfill(45)

result = [0] * 45

for digit in range(0, 45):
    for num in range(A, B + 1):

        num_bin = to_bin(num)

        if result[digit] + int(num_bin[digit]) == 1:
            result[digit] = 1
        else:
            result[digit] = 0

result_str = ''

for digit in result:
    result_str += str(digit)


print(int(result_str, 2))


### FIXED CODE ###

def to_bin(number):

    return bin(number)[2:].zfill(45)


def xor(num1, num2):

    num1_str = to_bin(num1)
    num2_str = to_bin(num2)

    result_list = [0] * 45

    for digit in range(0, 45):
        result_list[digit] += int(num1_str[digit])
        result_list[digit] += int(num2_str[digit])

    result_str = ''

    for digit in result_list:

        if digit % 2 == 0:
            result_str += '0'
        else:
            result_str += '1'
    return int(result_str, 2)


def f(a, b):
    if a > 0:
        a -= 1

    return xor(g(a), g(b))


def g(num):

    others = 0

    if num % 2 == 0:
        if (num // 2) % 2 != 0:
            others = 1

        return xor(num, others)
    else:
        if ((num - 1) // 2) % 2 != 0:
            others = 1

        return xor(xor(num, others), num - 1)


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

result = f(A, B)

print(result)
### BUGGY CODE ###

from collections import defaultdict
import bisect
from sys import stdin
input = stdin.readline


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

  # dic = defaultdict(int)
  # for l in L:
  #   dic[l] += 1
  # uniq = sorted(dic.keys())
  # sum_ = [0]*(uniq[-1]+1)
  # for i in range(1, uniq[-1]+1):
  #   sum_[i] = sum_[i-1] + dic[i]
  L = sorted(L)

  ans = 0
  for i in range(N):
    for j in range(i+1, N):
      if i == j:
        continue
      a = L[i]
      b = L[j]
      # lower = bisect.bisect_right(L[:i]+L[i+1:j]+L[j+1:], abs(a-b)) - 1
      # upper = bisect.bisect_right(L[:i]+L[i+1:j]+L[j+1:], a+b) - 1
      lower = bisect.bisect_right(L[j+1:], abs(a-b)) - 1
      upper = bisect.bisect_left(L[j+1:], a+b) - 1
      # print(a, b, lower, upper)
      # print(f'--> {L[j+1:]}')

      # if lower < 0 or upper < 0: continue
      if upper < 0: continue
      ans += (upper - max(lower, 0) + 1)

  # print(dic)
  # print(uniq)
  # print(sum_)
  print(ans)


if(__name__ == '__main__'):
  main()


### FIXED CODE ###

from collections import defaultdict
import bisect
from sys import stdin
input = stdin.readline


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

  # dic = defaultdict(int)
  # for l in L:
  #   dic[l] += 1
  # uniq = sorted(dic.keys())
  # sum_ = [0]*(uniq[-1]+1)
  # for i in range(1, uniq[-1]+1):
  #   sum_[i] = sum_[i-1] + dic[i]
  L = sorted(L)

  ans = 0
  for i in range(N):
    for j in range(i+1, N):
      if i == j:
        continue
      a = L[i]
      b = L[j]
      # lower = bisect.bisect_right(L[:i]+L[i+1:j]+L[j+1:], abs(a-b)) - 1
      # upper = bisect.bisect_right(L[:i]+L[i+1:j]+L[j+1:], a+b) - 1
      lower = bisect.bisect_right(L, abs(a-b), lo=j+1, hi=len(L)) - 1 - (j+1)
      upper = bisect.bisect_left(L, a+b, lo=j+1, hi=len(L)) - 1 - (j+1)
      # lower = bisect.bisect_right(L[j+1:], abs(a-b)) - 1
      # upper = bisect.bisect_left(L[j+1:], a+b) - 1

      # print(a, b, lower, upper)
      # print(f'--> {L[j+1:]}')

      # if lower < 0 or upper < 0: continue
      if upper < 0: continue
      ans += (upper - max(lower, 0) + 1)

  # print(dic)
  # print(uniq)
  # print(sum_)
  print(ans)


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

n=int(input())
a=[]
m=[]
for i in range(n):
  a.append(input())
kaisu=1
for i in range(n):
  if kaisu==a.count(a[i]):
    m.append(a[i])
  elif kaisu<a.count(a[i]):
    m=[a[i]]
    kaisu=a.count(a[i])
m=sorted(list(set(m)))
n=len(m)
for i in range(n):
  print(m[i])

### FIXED CODE ###

n=int(input())
s=[input() for i in range(n)]
s=sorted(s)
poll=[s[0]]
counta=[1]
kind=0
for i in range(1,n):
  if s[i]==s[i-1]:
    counta[kind]+=1
  else:
    kind+=1
    poll.append(s[i])
    counta.append(1)
m=max(counta)
for i in range(kind+1):
  if counta[i]==m:
    print(poll[i])
### BUGGY CODE ###

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

n = 62
D = [0]*n

for i in range(N):
    s = list(bin(A[i])[2:])[::-1]
    for j in range(len(s)):
        D[j] += int(s[j])
ans = 0
for i in range(n):
    ans += D[i]*(N-D[i])*2**i
    ans %= 10**9+7
print(ans)


### FIXED CODE ###

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

n = 62
D = [0]*n

for i in range(N):
    s = list(bin(A[i])[2:])[::-1]
    s = [i for i in range(len(s)) if s[i]=='1']
    for j in s:
        D[j] += 1
ans = 0
for i in range(n):
    ans += D[i]*(N-D[i])*2**i
    ans %= 10**9+7
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

N = inp()
p = [0] + list(map(float, input().split()))
dp = [[0] * (N + 1) for i in range(N + 1)]
dp[0][0] = 1

for i in range(1, N+1):
    for j in range(0, i+1):
        if j > 0:
            dp[i][j] = dp[i-1][j] * (1 - p[i]) + dp[i-1][j-1] * p[i]
        else:
            dp[i][j] = dp[i-1][j] * (1 - p[i])
_debug(dp)
ans = 0
for j in range(N//2 + 1, N + 1):
    ans += dp[N][j]
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10

from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

N = inp()
p = [0] + list(map(float, input().split()))
dp = [[0] * (N + 1) for i in range(N + 1)]
dp[0][0] = 1

for i in range(1, N+1):
    for j in range(0, i+1):
        if j > 0:
            dp[i][j] = dp[i-1][j] * (1 - p[i]) + dp[i-1][j-1] * p[i]
        else:
            dp[i][j] = dp[i-1][j] * (1 - p[i])
ans = 0
for j in range(N//2 + 1, N + 1):
    ans += dp[N][j]
print(ans)
### BUGGY CODE ###

n,k,q = map(int,input().split())
li = []
score = []

for i in range(q):
    a = int(input())
    li.append(a)

for i in range(n):
    score.append(k)

for i in range(len(li)):
    for j in range(len(score)):
        if j != li[i]-1:
            score[j]-=1

for i in range(len(score)):
    if score[i]>0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n,k,q = map(int,input().split())
li = []
score = []
count = []

for i in range(q):
    a = int(input())
    li.append(a)

for i in range(n):
    score.append(k)
    count.append(0)

for i in range(q):
    count[li[i]-1]+=1

for i in range(len(score)):
    score[i] = score[i] - q + count[i]
for i in range(len(score)):
    if score[i]>0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

def main():
    s=input()
    q=int(input())
    queryy=[]

    for i in range(q):
        queryy.append(tuple(input().split()))
    check=-1
    for query in queryy:
    #   print(query)
        if query[0]=="1":
            check*=-1
        else:
            if query[1]=="1":
                if check==-1:
                    s=str(query[2])+s
                else:
                    s+=str(query[2])
                    
            else:
                if check==-1:
                    s+=str(query[2])
                else:
                    s=str(query[2])+s
    if check==1:
        print(s[::-1]) 
    else:
        print(s)

if __name__=="__main__":
    main()

### FIXED CODE ###

def main():
    s=input()
    q=int(input())
    queryy=[]
    sent="a"
    back="a"
    for i in range(q):
        queryy.append(tuple(input().split()))
    check=-1
    for query in queryy:
    #   print(query)
        if query[0]=="1":
            check*=-1
        else:
            if query[1]=="1":
                if check==-1:
                    sent+=str(query[2])
                   # s=str(query[2])+s
                else:
                    back+=str(query[2])
                   # s+=str(query[2])
                    
            else:
                if check==-1:
                    back+=str(query[2])
                    #s+=str(query[2])
                else:
                    sent+=str(query[2])
                    #s=str(query[2])+s
   # print(type(sent))
    #if sent[0]=="1":
     #   sent=sent[1:]
    sent=sent[1:]
    sent=sent[::-1]   
    back=back[1:]

    if check==1:
        s=sent+s+back        
        print(s[::-1]) 
    else:
        s=sent+s+back
        print(s)

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

import numpy as np

s = input()

length = len(s)

dp = np.zeros((100100,13))

s = list(reversed(s))

dp[0][0]=1
ten = 1
mod = 1000000007


for i in range(length):
	if s[i] == '?':
		for num in range(10):
			d = num*ten
			for j in range(13):
				k = (j+d)%13
				dp[i+1][k] += dp[i][j]
				dp[i+1][k] %= mod
	else:
		num = int(s[i])
		d = num*ten
		for j in range(13):
			k = (j+d)%13
			dp[i+1][k] += dp[i][j]
			dp[i+1][k] %= mod
	ten *= 10
	ten %= 13

print(int(dp[length][5]%mod))

### FIXED CODE ###

from sys import stdin
s = stdin.readline()[:-1]

length = len(s)

dp = [[0 for i in range(13)]for j in range(100100)]

s = list(reversed(s))

dp[0][0]=1
ten = 1
mod = 1000000007


for i in range(length):
	if s[i] == '?':
		for num in range(10):
			d = num*ten
			for j in range(13):
				k = (j+d)%13
				dp[i+1][k] += dp[i][j]
				dp[i+1][k] %= mod
	else:
		num = int(s[i])
		d = num*ten
		for j in range(13):
			k = (j+d)%13
			dp[i+1][k] += dp[i][j]
			dp[i+1][k] %= mod
	ten *= 10
	ten %= 13

print(int(dp[length][5]%mod))
### BUGGY CODE ###

import math

N=int(input())
A=list(map(int,input().split()))
 
count=0
score=0
SUM=[0]
 
for i in range(N):
    SUM=SUM+[SUM[i]+A[i]]

    
SUM.sort()



for i in range(1,len(SUM)):
    if SUM[i]==SUM[i-1]:
        count=count+1
    else:
        if count!=0:
            score=score+math.factorial(count)
        count=0
        
if count!=0:
    score=score+math.factorial(count)

 
print(score)

### FIXED CODE ###

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

SUM=[0 for i in range(N+1)]
SUM[0]=0
 
for i in range(1,N+1):
    SUM[i]=SUM[i-1]+A[i-1]

    
SUM.sort()



for i in range(1,N+1):
    if SUM[i]==SUM[i-1]:
        count=count+1
    else:
        if count!=0:
            score=score+count*(count+1)//2
        count=0
        
if count!=0:
    score=score+count*(count+1)//2

 
print(score)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]
MOD = 10**9 + 7


def gcd(a, b):
    """ Greatest Common Divisor(最大公約数) """
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    """ Least Common Multiple(最小公倍数) """
    return a * (b // gcd(a, b))


N = _i()
a_list = _li()

a_lcm = 1
for a in a_list:
    a_lcm = lcm(a_lcm, a)

ans = 0
for a in a_list:
    ans = (ans + a_lcm // a) % MOD
print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]
MOD = 10**9 + 7


def gcd(a, b):
    """ Greatest Common Divisor(最大公約数) """
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    """ Least Common Multiple(最小公倍数) """
    return a * (b // gcd(a, b))


def calc_inverse_element_with_Fermat(a, MOD):
    """
    法をMODとしたときのaの逆元bを返す
    Fermatの小定理を用いる
    a * b = 1 (mod = MOD)

    Attention
    ---------
    MOD は素数の必要がある
    """
    return pow(a, MOD-2, MOD)


N = _i()
a_list = _li()

a_lcm = 1
for a in a_list:
    a_lcm = lcm(a_lcm, a)

a_lcm %= MOD
ans = 0
for a in a_list:
    ans = (ans + a_lcm * calc_inverse_element_with_Fermat(a, MOD)) % MOD
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from itertools import permutations
N, C = map(int, input().split())
D = [int(_) for c in range(C) for _ in input().split()]
G = [int(_) for n in range(N) for _ in input().split()]

table = [0] * C * 3
for row in range(N):
    for col in range(N):
        i = (row + col) % 3
        for c in range(C):
            table[i * C + c] += D[C * (G[N * row + col] - 1) + c]


def cost(comb):
    return table[C * 0 + comb[0]] + table[C * 1 + comb[1]] + table[C * 2
                                                                   + comb[2]]


combs = permutations(range(C), 3)
min_cst = cost(min(combs, key=lambda comb: cost(comb)))
print(min_cst)


### FIXED CODE ###

# -*- coding: utf-8 -*-
N, C = map(int, input().split())

D = []
for c in range(C):
    D.append([int(d) for d in input().split()])

Gmod = [[0 for i in range(C)] for i in range(3)]
for n in range(N):
    for m, g in enumerate(input().split()):
        Gmod[(n + m) % 3][int(g) - 1] += 1

K = []
for c0 in range(C):
    d0 = sum([Gmod[0][c] * D[c][c0] for c in range(C)])
    for c1 in [i for i in range(C) if not i == c0]:
        d1 = sum([Gmod[1][c] * D[c][c1] for c in range(C)])
        for c2 in [i for i in range(C) if (not i == c0) and (not i == c1)]:
            d2 = sum([Gmod[2][c] * D[c][c2] for c in range(C)])
            K.append(d0 + d1 + d2)

print(min(K))
### BUGGY CODE ###

n = int(input())
A = [int(i) for i in input().split()]
A.sort()
ans = 0
ans_list = []
kaburi = {}
for i in A:
    Flag = True
    for j in ans_list:
        if i==j:
            kaburi[i]=True
            Flag = False
            break
        if i%j==0:
            Flag = False
            break
    if Flag:
        ans_list.append(i)
        ans += 1
print(ans-len(kaburi))

### FIXED CODE ###

from collections import deque
import collections
import math
"""
#n = int(input())
#A = [int(i) for i in input().split()]
n = 10**5
A = [int(i)+1 for i in range(10**5,0,-1)]
A.sort()
ans = 0
ans_list = []
kaburi = {}
for i in A:
    Flag = True
    for j in ans_list:
        if i==j:
            kaburi[i]=True
            Flag = False
            break
        if i%j==0:
            Flag = False
            break
    if Flag:
        ans_list.append(i)
        ans += 1
print(ans-len(kaburi))
"""


n = int(input())
A = [int(i) for i in input().split()]
Max = max(A)
cnt_dict = collections.Counter(A)
#Dict[i]はi未満の約数がAに存在しなければTrue
Dict = {a:True for a in A}
for a in A:
    times = 2
    while a*times<=Max:
        Dict[a*times]=False
        times +=1
ans = 0
for a in A:
    if cnt_dict[a]==1 and Dict[a]:
        ans +=1
print(ans)
### BUGGY CODE ###

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

for i in range(a):
  N *= lis[i]
  
if N > 10**18:
  print(-1)
else:
  print(N)


### FIXED CODE ###

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

if 0 in lis:
  print(0)
  exit()

for i in range(a):
  N *= lis[i]
  if N > 10**18:
    print(-1)
    exit()

print(N)
### BUGGY CODE ###

import math

def gcd3(a,b,c):
    return math.gcd(math.gcd(a,b),c)

K = int(input())

A = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            A += gcd3(i+1, j+1, k+1)

print(A)

### FIXED CODE ###

import math

K = int(input())

A = 0

#3つとも同じ数字
for i in range(K):
    A += i+1
    
#2つ同じ数字
for i in range(K):
    for j in range(K):
        if i > j:
            A += 6*math.gcd(i+1, j+1)

#全部違う数字
for i in range(K):
    for j in range(K):
        for k in range(K):
            if i > j and j > k:
                A += 6*math.gcd(math.gcd(i+1, j+1), k+1)

print(A)
### BUGGY CODE ###

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

for i in range(N):
  mult *= a[i]
if mult > 10**18:
  print(-1)
else:
  print(mult)

### FIXED CODE ###

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

if 0 in A:
  print(0)
  exit()
for a in A:
  mult *= a
  if mult > 1e18:
    print(-1)
    exit()
print(mult)
### BUGGY CODE ###

N=int(input())
 
for h in range(1,3500):
  for n in range(1,3500):
    div=(4*h*n)-(N*n)-(N*h)
    if div!=0:
      w=N*h*n/div
      if w.is_integer() and w>0:
        print(h,n,int(w))
        exit()

### FIXED CODE ###

N=int(input())
 
for h in range(1,3501):
  for n in range(1,3501):
    #divが負数ならwは負数になる
    if (4*h*n)-(N*n)-(N*h)>0:
      w=N*h*n/((4*h*n)-(N*n)-(N*h))
      if w.is_integer():
        print(h,n,int(w))
        exit()
### BUGGY CODE ###

#inputは文字列として取得
input1=input()
input2=input()
#splitする必要がある
input2=input2.split(" ")

N=int(input1)
D=[int(s) for s in input2]

ans=None

if D.count(0)==1 and D[0]==0:

    mul=1
    n=1

    for i in range(1,max(D)+1):
        m=D.count(i)
        mul*=n**m
        mul=mul%998244353
        n=m
    
    ans=mul%998244353

else:
    ans=0

print(int(ans))

### FIXED CODE ###

#inputは文字列として取得
input1=input()
input2=input()
#splitする必要がある
input2=input2.split(" ")

N=int(input1)
D=[int(s) for s in input2]

ans=None


if D.count(0)==1 and D[0]==0:

    L=[0]*(max(D)+1)

    for i in range(len(D)):
        L[D[i]]+=1

    mul=1

    for i in range(len(L)-1):
        mul*=L[i]**L[i+1]%998244353
    
    ans=mul%998244353

else:
    ans=0

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

N = int(input())
slist = [int(input()) for _ in range(N)]
anslist = []
for bit in range(1<<(N)):
    sum = 0
    for i in range(N):
        if bit & (1<<i):
            sum += slist[i]
    if sum % 10 != 0:
        anslist.append(sum)
if len(anslist) == 0:
    print(0)
else:
    print(max(anslist))

### FIXED CODE ###

import sys
N = int(input())
slist = [int(input()) for _ in range(N)]
ssum = sum(slist)
if ssum % 10 == 0:
    slist.sort()
    for s in slist:
        if  s % 10 != 0:
            print(ssum - s)
            sys.exit()
    print(0)
else:
    print(ssum)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split())) 
cnt = 0
b = []
for i in range(1,n+1):
  b.append(i-a[i-1])
for i in range(n):
  c = a[i]+ i+1
  cnt += b.count(c)
print(cnt)

### FIXED CODE ###

from collections import defaultdict
n = int(input())
a = list(map(int, input().split())) 
cnt = 0
c = defaultdict(int)
for i in range(n):
  c[i+1-a[i]] += 1
for i in range(n):
  cnt += c[a[i]+i+1]
print(cnt)
### BUGGY CODE ###

n=int(input())
ans=0
for i in range(1,n+1):
    a=i
    for j in range(2,1+int(i**.5)):
        b=0
        while i%j==0:
            i//=j
            b+=1
        a*=b+1
        if i==1:
            break
    if i!=1:
        a*=2
    ans+=a
print(ans)

### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,n+1):
    a=n//i
    ans+=i*a*(a+1)//2
print(ans)