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

n = int(input())
A = list(map(int,input().split()))
for i in range(1,n+1):
    print (A.count(i))


### FIXED CODE ###

n = int(input())
A = sorted(list(map(int,input().split())))
d = {}
for i in range(1,n+1):
    d[i] = 0

for v in A:
    d[v] += 1

for v in d.values():
    print (v)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
def ans(a,x):
  b=0
  c=a[:x]+a[x+1:]
  d=list(set(c))
  for i in range(len(d)):
    m=c.count(d[i])
    if m>1:
      b=b+m*(m-1)/2
  return b
for k in range(n):
  print(int(ans(a,k)))

### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
s=Counter(a)
res=0
for i in s.values():
    res+=i*(i-1)//2
ans=0
for j in range(n):
    if s[a[j]]==1:
        print(res)
    else:
        ans=res-s[a[j]]+1
        print(ans)
### BUGGY CODE ###

def main():
    import bisect
    import sys
    from itertools import accumulate
    input = sys.stdin.readline
    def hsnum(ls,x):
        num = 0
        for i in range(n):
            y = x-ls[i]
            num += n-bisect.bisect_left(ls,y)
        return num
    n,m = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    suma = [0]+list(accumulate(a))
    lx = 0
    rx = 2*10**5+2
    error = 0
    while lx < rx:
        mx = (lx+rx)//2
        if hsnum(a,mx) < m:
            rx = mx
        elif hsnum(a,mx) > m:
            if hsnum(a,mx+1) < m:
                error = hsnum(a,mx)-m
                lx = mx
                break
            lx = mx + 1
        else:
            lx = mx
            break
    ans = 0
    for i in range(n):
        rema = lx - a[i]
        j = bisect.bisect_left(a,rema)
        ans += (n-j)*a[i]+suma[n]-suma[j]
    print(ans-error*lx)
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
  import bisect
  import sys
  from itertools import accumulate
  input = sys.stdin.readline
  def hsnum(x):
    num = 0
    for i in a:
      y = x-i
      num += n-bisect.bisect_left(a,y)
    return num
  n,m = map(int, input().split())
  a = list(map(int, input().split()))
  a.sort()
  suma = [0]+list(accumulate(a))
  lx = 0
  rx = 2*10**5+2
  error = 0
  while lx+1 < rx:
    mx = (lx+rx)//2
    if hsnum(mx) < m:
      rx = mx
    elif hsnum(mx) > m:
      lx = mx + 1
    else:
      lx = mx
      break
  if hsnum(lx)<m:
    lx -= 1
  error = hsnum(lx)-m
  ans = 0
  for i in a:
    rema = lx - i
    j = bisect.bisect_left(a,rema)
    ans += (n-j)*i-suma[j]
  ans += suma[n]*n
  print(ans-error*lx)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
big=10**9+7

def modsum(a,b):
  return a%big +b%big

n,m = map(int, input().split())

a = [0]*m
for i in range(m):
  a[i] = int(input())
  
#連続こわれ
for i in range(m-1):
  if a[i]+1 == a[i+1]:
    print(0)
    sys.exit(0)

cho = [0]*(n+1)
if 0 not in a:
  cho[0] = 1
if 1 not in a:
  cho[1] = 1

for i in range(2,n+1):
  if i not in a:
    cho[i] = modsum(cho[i-1], cho[i-2])


print(cho[-1]%big)

### FIXED CODE ###


big=10**9+7

n,m = map(int, input().split())

a = set([int(input()) for _ in range(m)])
  

cho = [0]*(n+1)
if 0 not in a:
  cho[0] = 1
if 1 not in a:
  cho[1] = 1

for i in range(2,n+1):
  if i not in a:
    cho[i] = (cho[i-1]+cho[i-2])%big


print(cho[-1])
### BUGGY CODE ###

n,q = map(int,input().split())
s = input()
for i in range(q):
    a,b = map(int,input().split())
    print(s.count("AC",a-1,b))

### FIXED CODE ###

n,q = map(int,input().split())
s = input()
cnt = [0] * (n+1)
for i in range(n):
    if s[i:i+2] == "AC":
        cnt[i+1] = cnt[i] + 1
    else:
        cnt[i+1] = cnt[i]
for i in range(q):
    l,r = map(int,input().split())
    print(cnt[r-1]-cnt[l-1])
### BUGGY CODE ###

from collections import Counter
import sys
n=int(sys.stdin.readline().rstrip())
S=[sys.stdin.readline().rstrip() for _ in range(n)]
    
cnt=Counter(S)
list=[]
for k in cnt.most_common():
    if k[1] != cnt.most_common()[0][1]:
        break
    list.append(k[0])

list.sort()
for i in list:
    print(i)

### FIXED CODE ###

from collections import Counter
import sys
n=int(sys.stdin.readline().rstrip())
S=[sys.stdin.readline().rstrip() for _ in range(n)]
    
cnt=Counter(S)
ma = max(cnt.values())
list=[]
for k in cnt.keys():
    if cnt[k] == ma:
      list.append(k)

list.sort()
for i in list:
    print(i)
### BUGGY CODE ###

N = int(input())
s = input()
# 左側のWの数と右側のEの数を数える
min = 3 * 10**5
for i in range(N):
    list_a = list(s[0:i])
    list_b = list(s[i:])
    #print(list_a, list_b)
    if list_a.count('W')+list_b.count('E') < min:
        min = list_a.count('W')+list_b.count('E')
print(min)

### FIXED CODE ###

N = int(input())
s = input()
# 左側のWの数と右側のEの数を数える (和が小さいのが答え)
# min = 3 * 10**5
# 毎回list_aとかの中身を計算させているのが良くない
# (一回計算したらわかる話)
list_a_cnt = 0
list_b_cnt = 0
list_a = list(s[0:0])
#print("list_a",list_a)
list_b = list(s[0:])
#print("list_b",list_b)
list_b_cnt = list_b.count('E')
min = list_a_cnt + list_b_cnt
for i in range(N):
    if s[i] == "W":
        list_a_cnt += 1
    elif s[i] == "E":
        list_b_cnt -= 1
    #print(s[0:i],s[i:])
    #print(list_a_cnt,list_b_cnt)
    if list_a_cnt + list_b_cnt < min:
        min = list_a_cnt + list_b_cnt
print(min)
### BUGGY CODE ###

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

v = [0] * N
w = [0] * N

for i in range(N):
    v[i], w[i] = map(int, input().split())

def rec(i, j):
    if i == N:
        res = 0
    elif j < w[i]:
        res = rec(i + 1, j)
    else:
        res = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i])
    return res

print(rec(0, W))

### FIXED CODE ###

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

v = [0] * N
w = [0] * N
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    v[i], w[i] = map(int, input().split())

for i in range(N - 1, -1, -1):
    for j in range(W + 1):
        if j < w[i]:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i])

print(dp[0][W])
### BUGGY CODE ###

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

ans = 1
for i in range(N):
    ans *= A[i]

if ans <= 10**18:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

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

ans = 1

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

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

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

n=int(input())
s=[]
count=0
for i in range(n):
    s.append(list(sorted(input())))
    if s.count(s[i])>1:
        count+=(s.count(s[i])-1)
print(count)

### FIXED CODE ###

n = int(input())
count = {}
res = 0
for i in range(n):
  si = input()
  sortedSi = sorted(si)
  tSi = tuple(sortedSi)
  if tSi not in count:
    count[tSi] = 0
  res += count[tSi]
  count[tSi] += 1
print(res)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
q=[]
r=[[0]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if g[i][j]=="#":
            g[i][j]=0
            r[i][j]=1
            q.append([i,j])
dx=[1,-1,0,0]
dy=[0,0,1,-1]
ans=0
while q:

    i,j=q.pop(0)
    for x,y in zip(dx,dy):
        if i+y<0 or i+y>=h or j+x<0 or j+x>=w:
            continue
        if r[i+y][j+x]:
            continue
        g[i+y][j+x]=g[i][j]+1
        r[i+y][j+x]+=1
        ans=max(ans,g[i+y][j+x])
        q.append([i+y,j+x])
print(ans)


### FIXED CODE ###

from collections import deque
h,w=map(int,input().split())
a=[input() for _ in range(h)]
dxy=[(0,1),(1,0),(-1,0),(0,-1)]
inf=float("inf")

dp=[[inf]*w for _ in range(h)]
q=deque()

for y,l in enumerate(a):
    for x,c in enumerate(l):
        if c=="#":
            dp[y][x]=0
            q.append((x,y))
ans=0
while q:
    x,y=q.popleft()
    d=dp[y][x]
    for dx,dy in dxy:
        nx,ny=x+dx,y+dy
        if not 0<=nx<w: continue
        if not 0<=ny<h: continue
        if dp[ny][nx]<=d+1: continue
        dp[ny][nx]=d+1
        q.append((nx,ny))
        ans=max(ans,d+1)
print(ans)
### BUGGY CODE ###

import math
import bisect

import sys
input = sys.stdin.readline

def Solve():
    L=[]
    N=int(input())
    for i in range(N):
        L.append(int(input()))
    

    col=1
    K=[]
    for i,a in enumerate(L):
        if i==0:
            K.append(a)
            continue
        pos=bisect.bisect_left(K,a)
        if pos==0:
            col+=1
            K=[a]+K
        else:
            K[pos-1]=a

    return col



print(Solve())




### FIXED CODE ###

import math
import bisect
from collections import deque
import sys
input = sys.stdin.readline


def Solve():
    L=[]
    N=int(input())
    for i in range(N):
        L.append(int(input()))

    col=1
    K=deque()
    
    
    for i,a in enumerate(L):
        if i==0:
            K.append(a)
            continue
        pos=bisect.bisect_left(K,a)
        if pos==0:
            col+=1
            K.appendleft(a)
        else:
            K[pos-1]=a

    return col



print(Solve())
### BUGGY CODE ###

import itertools
from sys import stdin
N=list(map(int,stdin.readline().strip().split()))[0]
st=list(stdin.readline().strip())
count=0
stt=set(st)
stt=list(stt)
num=["0","1","2","3","4","5","6","7","8","9"]
num = [s for s in num if s in stt ]
num_list= ["".join(i) for i in itertools.product(num,repeat=3)]

for number in num_list:
    cnt = 0
    for i in range(N):
        if number[cnt]==st[i]:
            cnt+=1
            if cnt==3:
                count += 1
                break
    

print(count)

### FIXED CODE ###

def main():
  N = int(input())
  S = list(map(int,input()))
  ans = 0
  for i in range(10):
    for j in range(10):
      for k in range(10):
        flg = False
        flg2 = False
        for x in range(N):
          if flg2:
            break
          if not flg:
            if S[x] == i:
              flg = True
          else:
            if S[x] == j:
              flg2 = True
              if k in S[x+1:]:
                ans +=1
  print(ans)
main()
### BUGGY CODE ###

# B
import numpy as np
np.random.seed(1)
from collections import deque
# input
N, M = map(int, input().split())
G = dict()
for n in range(1, N+1):
    G[n] = []

for _ in range(M):
    A, B = map(int, input().split())
    G[A].append(B)
    G[B].append(A)
    
# find minimum degree
sv = np.array([len(G[k]) for k in range(1, N+1)])
s = np.random.choice(np.arange(N)[sv == min(sv)]) + 1

targets = dict()
for a in G[s]:
    targets[a] = 1


# BFS from st
t = G[s][0]
pt = [s, t]
del targets[t]
while len(targets) > 0:
    ques = deque()
    visited = [0]*(N+1)    
    for a in pt:
        visited[a] = 1
    ques.append([t, pt])
    end = 0
    while len(ques) > 0 and end == 0:
        q = ques.popleft()
        s = q[0]
        pt = q[1]
        for t in G[s]:
            if visited[t] == 1:
                pass
            elif t in targets.keys():
                pt.append(t)
                end = 1
                del targets[t]
                break
            else:
                visited[t] = 1
                ques.append([t, pt+[t]])
            

# BFS from end
visited = [0]*(N+1)
for a in pt:
    visited[a] = 1
sv = np.array([len([l for l in G[k] if visited[l] == 0]) if visited[k] == 0 else N for k in range(1, N+1)])

# need calculation
if len([l for l in G[t] if visited[l] == 0]) != 0:
    endp = np.random.choice(np.arange(N)[sv == min(sv)]) + 1
    targets = dict()
    for a in G[endp]:
        if visited[a] == 0:
            targets[a] = 1
    while len(targets) > 0:
        ques = deque()
        visited = [0]*(N+1)    
        for a in pt:
            visited[a] = 1
        visited[endp] = 1
        ques.append([t, pt])
        end = 0
        while len(ques) > 0 and end == 0:
            q = ques.popleft()
            s = q[0]
            pt = q[1]
            for t in G[s]:
                if visited[t] == 1:
                    pass
                elif t in targets.keys():
                    pt.append(t)
                    end = 1
                    del targets[t]
                    break
                else:
                    visited[t] = 1
                    ques.append([t, pt+[t]])
    pt.append(endp)
        
print(len(pt))
print(" ".join([str(a) for a in pt]))

### FIXED CODE ###

# B
import numpy as np
from collections import deque
# input
N, M = map(int, input().split())
G = dict()
for n in range(1, N+1):
    G[n] = []
    
visited = [0]*(N+1)
for m in range(M):
    A, B = map(int, input().split())
    G[A].append(B)
    G[B].append(A)
    if m == 0:
        pt = [A, B]
        visited[A] = 1
        visited[B] = 1

# from left
s = pt[0]
add_left = list()

while True:
    left_ext = [l for l in G[s] if visited[l] == 0]
    if len(left_ext) != 0:
        s = left_ext[0]
        visited[s] = 1
        add_left.append(s)
    else:
        break

# from right
s = pt[1]
add_right = list()

while True:
    right_ext = [l for l in G[s] if visited[l] == 0]
    if len(right_ext) != 0:
        s = right_ext[0]
        visited[s] = 1
        add_right.append(s)
    else:
        break
pt = list(reversed(add_left)) + pt + add_right
print(len(pt))
print(" ".join([str(a) for a in pt]))
### BUGGY CODE ###

s = input()
x,y = map(int,input().split())
count = 0
d = []
for i in range(len(s)):
    if s[i] == 'F':
        count += 1
    else:
        d.append(count)
        count = 0
if count != 0:
    d.append(count)

dx = [d[i] for i in range(len(d)) if i%2==0]
dy = [d[i] for i in range(len(d)) if i%2==1]
if len(dx) == 0:
    dx = [0]
if len(dy) == 0:
    dy = [0]
dpx = [dx[0]]
dpy = [dy[0],-dy[0]]
for i in range(len(dx)-1):
    trans = set()
    for j in range(len(dpx)):
        trans.add(dpx[j]+dx[i+1])
        trans.add(dpx[j]-dx[i+1])
    dpx = list(trans)
for i in range(len(dy)-1):
    trans = set()
    for j in range(len(dpy)):
        trans.add(dpy[j]+dy[i+1])
        trans.add(dpy[j]-dy[i+1])
    dpy = list(trans)
ans = (x in dpx)&(y in dpy)

if ans:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = input()
x,y = map(int,input().split())
count = 0
d = []
s = s.split('T')
d = [len(x) for x in s]

if len(d) == 0:
    d.append(0)
if len(d) == 1:
    d.append(0)
dpx = [d[0]]
dpy = [d[1],-d[1]]
for i in range(2,len(d)):
    di = d[i]
    trans = set()
    if i%2==0:
        for xj in dpx:
            trans.add(xj+di)
            trans.add(xj-di)
        dpx = list(trans)
    else:
        for yj in dpy:
            trans.add(yj+di)
            trans.add(yj-di)
        dpy = list(trans)
ans = (x in dpx)&(y in dpy)

if ans:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

s=input()
t=input()

ans = "Yes"

for i in range(len(s)-1):
    if s[i]!=t[i]:
        s_same = s[i+1:].find(s[i])
        t_same = t[i+1:].find(t[i])
        if s_same!=t_same:
            ans="No"
            break
print(ans)

### FIXED CODE ###

s=input()
t=input()

ans = "Yes"
_dict = {}

for i in range(len(s)):
    if s[i] not in _dict:
        _dict[s[i]]=t[i]
    elif s[i] in _dict:
        if t[i] != _dict[s[i]]:
            ans="No"
            break

_dict = {}
for i in range(len(s)):
    if t[i] not in _dict:
        _dict[t[i]]=s[i]
    elif t[i] in _dict:
        if s[i] != _dict[t[i]]:
            ans="No"
            break
print(ans)
### BUGGY CODE ###

a,b,c,d=map(int,input().split())
mod=998244353
dct=[[[-1]*3 for _ in range(d+1)] for _ in range(c+1)]

import sys
sys.setrecursionlimit(10**7)
def dp(i,j,bl):
  #print(i,j,bl)
  if dct[i][j][bl]>0:
    return dct[i][j][bl]
  if (i,j)==(a,b):
    return 1 if bl==0 else 0
  if i<a or j<b:
    return 0
  if i==a:
    if bl==2:
      ret=0 if j-b<2 else pow(i,j-b,mod)-pow(i-1,j-b-1,mod)*(j-b)-pow(i-1,j-b,mod)
    elif bl==1:
      ret=0 if j-b<1 else pow(i-1,j-b-1,mod)*(j-b)
    elif bl==0:
      ret=pow(i-1,j-b,mod)
  elif bl==2:
    ret=dp(i,j-1,1)+dp(i,j-1,2)*i
  elif bl==1:
    ret=(dp(i-1,j,0)+dp(i-1,j,1)+dp(i-1,j,2))*j
  else:
    ret=dp(i,j-1,0)*(i-1)
  ret%=mod
  dct[i][j][bl]=ret
  return ret

print((dp(c,d,0)+dp(c,d,1)+dp(c,d,2))%mod)


### FIXED CODE ###

a,b,c,d=map(int,input().split())
mod=998244353

dp1=[[0]*(d+1) for _ in range(c+1)]
dp2=[[0]*(d+1) for _ in range(c+1)]

for i in range(b+1,d+1):
  if a==1:
    dp1[a][i]=1 if i==b+1 else 0
    dp2[a][i]=0 if i==b+1 else 1
  else:
    dp1[a][i]=(pow(a-1,i-b-1,mod)*(i-b))%mod
    dp2[a][i]=(pow(a,i-b,mod)-dp1[a][i])%mod
for i in range(a+1,c+1):
  dp1[i][b]=pow(b,i-a,mod)
  dp2[i][b]=0
dp2[a][b]=1
for i in range(a+1,c+1):
  for j in range(b+1,d+1):
    dp1[i][j]=(j*(dp1[i-1][j]+dp2[i-1][j]))%mod
    dp2[i][j]=(dp1[i][j-1]+dp2[i][j-1]*i)%mod
print((dp1[c][d]+dp2[c][d])%mod)

"""
print('dp1')
for x in dp1:
  print(x)
print('dp2')
for x in dp2:
  print(x)
"""
### BUGGY CODE ###

array = list(map(int, input().split()))
tmp = array[0]
array[0] = abs(array[0] - array[1])
while (tmp >= array[0]):
  tmp = array[0]
  array[0] = abs(array[0] - array[1])
print(tmp)


### FIXED CODE ###

array = list(map(int, input().split()))
tmp = array[0] % array[1]
if (tmp <= array[1] / 2):
  print(tmp)
else:
  print(abs(tmp-array[1]))
### BUGGY CODE ###

from itertools import combinations

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

ans = 0

for v in combinations(l, 3):
    if v[0] < v[1] + v[2] and v[1] < v[0] + v[2] and v[2] < v[0] + v[1]:
        ans += 1

print(ans)


### FIXED CODE ###

import bisect

N = int(input())
Ls = list(map(int, input().split()))
Ls.sort()

# O(N^2 * logN)の全探索で解く
ans = 0
for a_i in range(N):
    for b_i in range(a_i+1, N):
        c_i = bisect.bisect_left(Ls, Ls[a_i]+Ls[b_i])
        if c_i > b_i:
            ans += c_i - b_i - 1
        else:
            pass

print(ans)

# from itertools import combinations
# import numpy as np
#
# n = int(input())
# hoge = list(map(int, input().split()))
# hoge.sort()
#
# # hoge = np.sort(l)
# ll = []
# ans = 0
#
# def triangle(target, v1, v2):
#     return target < v1 + v2
#
# for i in range(len(hoge)):
#     for j in range(i + 1, len(hoge)):
#         left = hoge[j]
#         right = hoge[-1] + 1
#         while left + 1 < right:
#             mid = (left + right) / 2
#             if triangle(mid, hoge[i], hoge[j]):
#                 ans += len(hoge[hoge >= mid])
#                 break
#             else:
#                 left = mid
#
# print(ans)

"""3回目
# 事前の各要素xより大きい要素個数を求める
for v in hoge:
    ll.append([v, len(hoge[v <= hoge])])

# 事前にコンビネーションを確保する。ループはしない！
combi = np.array([[sum(v), v[1]] for v in combinations(hoge, 2)])

print(combi)
print(combi[:, 0])
print(ll)

# 要素のループをもう一度回し、各
for v, cnt in ll:
    print(v, cnt, len(combi[(v < combi[:, 0]) & (combi[] < v)]), sep=',')
    ans += cnt * len(combi[v < combi])

print(ans)

"""


"""2回目 comnbinationループがだめ
for v in combinations(hoge, 2):
    s = sum(v)
    ans += len(hoge[(v[1] < hoge) & (hoge < s)])

"""



"""1
これだとTLEが出る
combinationの全パターンを数え上げると遅すぎる
ソート済み配列 × なにかで組み合わせを数え上げる必要

from itertools import combinations

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

ans = 0

for v in combinations(l, 3): # combination を使ってループした時点ででn^2
    if v[0] < v[1] + v[2] and v[1] < v[0] + v[2] and v[2] < v[0] + v[1]:
        ans += 1

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

def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    a = list(map(int, input().split()))
    inf = 10 ** 13
    dp = [[0]*N for i in range(N)]
    s = [0] * (N+1)
    for i, x in enumerate(a):
        s[i+1] = s[i] + x
        dp[i][i] = 0
    for i in range(N-2, -1, -1):
        DP = dp[i]
        si = s[i]
        for j in range(i+1, N):
            tmp = s[j+1] - si
            D = inf
            for k in range(i, j):
                if D > DP[k]+dp[k+1][j]:
                    D = DP[k]+dp[k+1][j]
            DP[j] = D + tmp
    print(dp[0][N-1])


main()


### FIXED CODE ###

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

    dp = [[10**13]*N for i in range(N)]
    s = [0] * (N+1)
    for i in range(N):
        s[i+1] = s[i] + a[i]
        dp[i][i] = 0
    for i in range(N-1, -1, -1):
        for j in range(i+1, N):
            tmp = s[j+1] - s[i]
            for k in range(i, j):
                dp[i][j] = min(dp[i][j], dp[i][k]+dp[k+1][j] + tmp)

    print(dp[0][N-1])


main()
### BUGGY CODE ###

from collections import Counter
from functools import lru_cache


@lru_cache(maxsize=None)
def get_dividers(n):
    """
    正の整数 n の約数を取得する
    """

    dividers = {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}
    return dividers | {n // d for d in dividers}


@lru_cache(maxsize=None)
def lcm(a, b):
    """
    aとbの最小公倍数を計算する
    """
    from math import gcd

    return a * b // gcd(a, b)


N = int(input())
A = tuple(map(int, input().split(' ')))

counter = Counter()
for a in A:
    for d in get_dividers(a):
        counter[d] += 1

ans = 1
candidates = []
for key, value in counter.items():
    if value == N:
        ans = lcm(ans, key)
    elif value == N - 1:
        candidates.append(key)

if candidates:
    ans = max([lcm(ans, c) for c in candidates])

print(ans)


### FIXED CODE ###

from collections import Counter
from functools import lru_cache


@lru_cache(maxsize=None)
def get_dividers(n):
    """
    正の整数 n の約数を取得する
    """

    dividers = {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}
    return dividers | {n // d for d in dividers}


@lru_cache(maxsize=None)
def lcm(a, b):
    """
    aとbの最小公倍数を計算する
    """
    from math import gcd

    return a * b // gcd(a, b)


N = int(input())
A = tuple(map(int, input().split(' ')))

counter = Counter()
for a in A:
    for d in get_dividers(a):
        counter[d] += 1

ans = 1
candidates = []
for key, value in counter.items():
    if value == N:
        ans = lcm(ans, key)
    elif value == N - 1:
        candidates.append(key)

if candidates:
    ans = max([lcm(ans, c) for c in candidates])

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

from collections import deque

s=list(input())
Q=int(input())

d=deque(s)
cnt=0
for i in range(Q):
    tmp=list(input())
    if tmp[0] == "1":
        cnt+=1
    else:
        if tmp[2] == "1":
            if (cnt > 0) and (cnt%2 == 0):
                d.appendleft(tmp[4])
                cnt=0
            elif cnt > 0:
                d.reverse()
                d.appendleft(tmp[4])
                cnt=0
            else:
                d.appendleft(tmp[4])
        else:
            if (cnt > 0) and (cnt%2 == 0):
                d.append(tmp[4])
                cnt=0
            elif cnt > 0:
                d.reverse()
                d.append(tmp[4])
                cnt=0
            else:
                d.append(tmp[4])
if (cnt > 0) and (cnt%2 != 0):
    d.reverse()
ans=list(d)
answer="".join(ans)
print(answer)

### FIXED CODE ###

from collections import deque
import sys
input2 = sys.stdin.readline()

s=list(input2)
Q=int(input())
direction=0
d=deque(s)
d.pop()

for i in range(Q):
    tmp=list(input())
    if tmp[0] == "1":
        if direction == 0:
            direction = 1
        else:
            direction = 0
    else:
        if tmp[2] == "1":
            if direction == 0:
                d.appendleft(tmp[4])
            else:
                d.append(tmp[4])
        else:
            if direction == 0:
                d.append(tmp[4])
            else:
                d.appendleft(tmp[4])
if direction==1:
    d.reverse()
ans=list(d)
answer="".join(ans)
print(answer)
### BUGGY CODE ###

s=input()
k=int(input())
right=0
left=0
r=[]
while right<len(s):
  r.append(s[right:left+1])
  left+=1
  if left==len(s):
    right+=1
    left=right
print(sorted(set(r))[k-1])

### FIXED CODE ###

s=input()
k=int(input())
n=len(s)
r=[]
for right in range(0,n):
  for left in range(right+1, right+k+1):
    r.append(s[right:left])
print(sorted(set(r))[k-1])