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

from functools import reduce, lru_cache


@lru_cache(maxsize=2**12)
def GCD(x, y):
    if y == 0:
        return x
    else:
        return GCD(y, x % y)


def lcm(x, y):
    return (x * y) // GCD(x, y)


def solve():
    MOD = 10 ** 9 + 7
    N, *A = map(int, open(0).read().split())
    
    lcm_num = reduce(lcm, A)
    ans = 0
    for a in A:
        ans += lcm_num // a
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

from fractions import gcd


def solve():
    N, *A = map(int, open(0).read().split())
    MOD = 10 ** 9 + 7

    lcm = 1
    for a in A:
        lcm = a * lcm // gcd(a, lcm)

    ans = [lcm // a for a in A]
    print(sum(ans) % MOD)


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

N, M = map(int, input().split(" "))
A = [int(_) for _ in input().split(" ")]

for i in range(M):
    tmp_index = A.index(max(A))
    A[tmp_index] = A[tmp_index] // 2    # ここが修正箇所

print(sum(A))

### FIXED CODE ###

import heapq

N, M = map(int, input().split(" "))
A = [-int(_) for _ in input().split(" ")]

heapq.heapify(A)

for i in range(M):
    heapq.heappush(A, -(-heapq.heappop(A)// 2))
    
print(-sum(A))
### BUGGY CODE ###

import sys

input = sys.stdin.readline

INF = 10**12

H, N = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[INF]*(H+1) for _ in range(N+1)]
dp[0][0] = 0
for i, (a, b) in enumerate(magics):
    for j in range(H+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        dp[i+1][min(H, j+a)] = min(dp[i+1][min(H, j+a)], dp[i+1][j] + b)
print(dp[N][H])

### FIXED CODE ###

INF = 10**12

H, N = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[INF]*(H+1) for _ in range(N+1)]
dp[0][0] = 0
for i, (a, b) in enumerate(magics):
    for j in range(H+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        dp[i+1][min(H, j+a)] = min(dp[i+1][min(H, j+a)], dp[i+1][j] + b)
print(dp[N][H])
### BUGGY 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())

S = [input() for _ in range(H)]
dist = [[float("inf") for i in range(W)] for j in range(H)]
dist[C_h-1][C_w-1] = 0

d = deque([[C_h-1, C_w-1, 0]])

def check_movable(h, w):
    if h < 0 or h >= H or w < 0 or w >= W:
        return False
    if S[h][w] == "#":
        return False
    else:
        return True

def check_appnendable(h, w, cost):
    if not check_movable(h,w):
        return False
    if dist[h][w] > cost:
        return True
    else:
        return False

dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
while d:
    h, w, cost = d.pop()
    for dh, dw in zip(dx, dy):
        if check_appnendable(h+dh, w+dw, cost):
            d.append([h+dh, w+dw, cost])
            dist[h+dh][w+dw] = min(dist[h+dh][w+dw], cost)
    for dh in range(-2, 3):
        for dw in range(-2, 3):
            if check_appnendable(h+dh, w+dw, cost+1):
                d.appendleft([h+dh, w+dw, cost+1])
                dist[h+dh][w+dw] = min(dist[h+dh][w+dw], cost+1)

if dist[D_h-1][D_w-1] < float("inf"):
    print(dist[D_h-1][D_w-1])
else:
    print(-1)

### 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())

S = [input() for _ in range(H)]
dist = [[float("inf") for i in range(W)] for j in range(H)]
dist[C_h-1][C_w-1] = 0

d = deque([[C_h-1, C_w-1, 0]])

def check_movable(h, w):
    if h < 0 or h >= H or w < 0 or w >= W:
        return False
    if S[h][w] == "#":
        return False
    else:
        return True

def check_appnendable(h, w, cost):
    if not check_movable(h,w):
        return False
    if dist[h][w] > cost:
        return True
    else:
        return False

dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
while d:
    h, w, cost = d.pop()
    for dh, dw in zip(dx, dy):
        if check_appnendable(h+dh, w+dw, cost):
            d.append([h+dh, w+dw, cost])
            dist[h+dh][w+dw] = cost
    for dh in range(-2, 3):
        for dw in range(-2, 3):
            if check_appnendable(h+dh, w+dw, cost+1):
                d.appendleft([h+dh, w+dw, cost+1])
                dist[h+dh][w+dw] =cost+1

if dist[D_h-1][D_w-1] < float("inf"):
    print(dist[D_h-1][D_w-1])
else:
    print(-1)
### BUGGY CODE ###

import numpy as np

N = int(input())
nums = np.array([int(input()) for _ in range(N)])

org_indices = np.ones(N, dtype=bool)
for i in range(N):
    indices = np.copy(org_indices)
    indices[i] = False
    print(np.amax(nums[indices]))

### FIXED CODE ###

import numpy as np

N = int(input())
nums = np.array([int(input()) for _ in range(N)])

# 最も大きな値を調べる
sorted_nums = sorted(nums, reverse=True)
max_num = sorted_nums[0]
# 2番目に大きな値を調べる
second_max_num = sorted_nums[1]

for i in range(N):
    # 除外する値を取得する
    exclude_num = nums[i]
    # 除外する値が最大値なら2番目の値を表示する
    if exclude_num == max_num:
        print(second_max_num)
    # それ以外なら最大値を表示する
    else:
        print(max_num)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

L,R=map(int, input().split())

ans = 2 * (10**9)

for i in range(L,R+1):
    for j in range(i+1,min(R+1,2*L)):
        ans = min(ans, ((i%2019)*(j%2019)%2019))

print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-

L,R=map(int, input().split())

ans = 2 * (10**9)

for i in range(L,min(R+1,L+2019)):
    for j in range(i+1,min(R+1,L+2019)):
        ans = min(ans, ((i%2019)*(j%2019)%2019))

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

import heapq
inf=10**9


def Prim():
    D=[inf for _ in range(n+1)]
    color=["white" for _ in range(n+1)]

    D[1]=0
    queue=[[0,1]]
    heapq.heapify(queue)
    while len(queue)>0:
        u=heapq.heappop(queue)[1]
        color[u]="black"

        V=[[i,j] for i,j in M[u] if color[j]!="black"]
        if len(V)>0:
            for i,j in V:
                if i<D[j]:
                    D[j]=i
                    color[j]="gray"
                    heapq.heappush(queue,[i,j])

    return D


n=int(input())
XY=[list(map(int,input().split()))+[i+1] for i in range(n)]
M=[[] for _ in range(n+1)]
A,B=sorted(XY),sorted(XY,key=lambda x:x[1])

for i in range(n):
    if i!=0:
        M[A[i][2]].append([min(abs(A[i-1][0]-A[i][0]),abs(A[i-1][1]-A[i][1])),A[i-1][2]])
        M[B[i][2]].append([min(abs(B[i][0] - B[i - 1][0]), abs(B[i][1] - B[i - 1][1])), B[i - 1][2]])
    if i!=n-1:
        M[A[i][2]].append([min(abs(A[i+1][0]-A[i][0]),abs(A[i+1][1]-A[i][1])),A[i+1][2]])
        M[B[i][2]].append([min(abs(B[i][0]-B[i+1][0]),abs(B[i][1]-B[i+1][1])),B[i+1][2]])

print(sum(Prim()[1:]))

### FIXED CODE ###

class UnionFind():
    def __init__(self,n):
        self.n=n
        self.root=[-1]*n
        self.rank=[-1]*n

    def Find_Root(self,x):
        if self.root[x]<0:return x
        else:
            self.root[x]=self.Find_Root(self.root[x])
            return self.root[x]

    def Unite(self,x,y):
        x=self.Find_Root(x)
        y=self.Find_Root(y)

        if x==y:return
        elif self.rank[x]>self.rank[y]:
            self.root[x] +=self.root[y]
            self.root[y]=x
        else:
            self.root[y] +=self.root[x]
            self.root[x]=y
            if self.rank[x]==self.rank[y]:
                self.rank[y] +=1

    def isSameGroup(self,x,y):
        return self.Find_Root(x)==self.Find_Root(y)

    def size(self,x):
        return -self.root[self.Find_Root(x)]

    def members(self,x):
        root=self.Find_Root(x)
        return [i for i in range(self.n) if self.Find_Root(i)==root]

    def roots(self):
        return[i for i,j in enumerate(self.root) if j<0]

    def group_members(self):
        return {i:self.members(i) for i in self.roots()}

    def group_count(self):
        return len(self.roots())


def kruskal():
    D,M=[],[]

    A,B=sorted(XY),sorted(XY, key=lambda x: x[1])
    for i in range(n-1):
        M.append([min(abs(A[i][0]-A[i+1][0]),abs(A[i][1]-A[i+1][1])),A[i][2],A[i+1][2]])
        M.append([min(abs(B[i][0]-B[i+1][0]),abs(B[i][1]-B[i+1][1])),B[i][2],B[i+1][2]])

    M.sort()
    for w,s,t in M:
        if UnionFind.isSameGroup(s,t) is False:
            UnionFind.Unite(s,t)
            D.append(w)

    return D


import sys
input=sys.stdin.readline

n=int(input())
XY=[list(map(int,input().split()))+[i+1] for i in range(n)]
UnionFind=UnionFind(n+1)
print(sum(kruskal()))
### BUGGY CODE ###

from collections import deque

def main():
  N,M=map(int,input().split())
  r=[[]for i in range(N)]
  d,p=[10**6]*N,[10**6]*N

  for i in range(M):
    a,b=map(int,input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)

  q=deque([0])
  p[0],d[0]=-1,0

  while len(q)!=0:
    i=q.pop()
    for j in r[i]:
      if d[j]>d[i]+1:
        d[j],p[j]=d[i]+1,i
        q.append(j)

  print('Yes')
  for i in range(1,N):
    print(p[i]+1)

main()


### FIXED CODE ###

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

  r=[[]for i in range(N)]
  for i in range(M):
    a,b=map(int,input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)

  p=[-1]*N
  q=[0]
  while q:
    i=q.pop(0)
    for j in r[i]:
      if p[j]==-1:
        p[j]=i
        q.append(j)

  print('Yes')
  for i in range(1,N):
    print(p[i]+1)

main()
### BUGGY CODE ###

def resolve():
    a = [int(input()) for _ in range(int(input()))]
    st = sorted(a)
    count = len(st)
    for i in a:
        index = st.index(i)
        if index == (count - 1):
            print(st[-2])
        else:
            print(st[-1])


resolve()

### FIXED CODE ###

def resolve():
    a = [int(input()) for _ in range(int(input()))]
    st = sorted(a)
    first = st[-1]
    second = st[-2]
    for i in a:
        if i == first:
            print(second)
        else:
            print(first)


resolve()
### BUGGY CODE ###

def main():
    n,p=map(int,input().split())
    s=list(map(int,list(input())))
    dp=[[0]*p for _ in range(n+1)]
    for i in range(1,n+1):
      dp[i][s[i-1]%p]+=1
      for j in range(0,p):
        dp[i][(j*10+s[i-1])%p]+=dp[i-1][j]
    ans=0
    for i in range(1,n+1):
      ans+=dp[i][0]
    print(ans)     

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n,p=map(int,input().split())
    s=list(map(int,list(input())))
    cnt,ans=0,0
    m=[0]*p
    m[0]=1

    if p in [2, 5]:
        for i, x in enumerate(s):
            if x % p == 0:
                ans += i + 1
        print(ans)
        exit()

    sm=0
    d=1
    for i in range(n):
        sm=(sm+s[n-1-i]*d)%p
        m[sm]+=1
        d=(d*10)%p
    
    for i in m:
        ans+=i*(i-1)//2

    print(ans)

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

from collections import deque


def main():
    height, width = map(int, input().split())
    q = deque([])
    grid = []
    change_time = [[-1 for _ in range(width)] for _ in range(height)]
    for i in range(height):
        now = list(input())
        for j in range(width):
            if now[j] == "#":
                q.append([i, j])
                change_time[i][j] = 0
        grid.append(now)
    d = [[0, 1], [1, 0], [0, -1], [-1, 0]]
    answer = 0
    while q:
        y, x = q.popleft()
        answer = change_time[y][x]
        for dy, dx in d:
            new_y = y + dy
            new_x = x + dx
            if 0 <= new_y < height and 0 <= new_x < width and grid[new_y][new_x] == ".":
                grid[new_y][new_x] = "#"
                change_time[new_y][new_x] = change_time[y][x] + 1
                q.append([new_y, new_x])
    print(answer)


if __name__ == '__main__':
    main()



### FIXED CODE ###

from collections import deque
from sys import stdin


def main():
    height, width = map(int, stdin.readline().split())
    q = deque([])
    grid = [stdin.readline() for _ in range(height)]
    distance = [[-1 for _ in range(width)] for _ in range(height)]
    for i in range(height):
        for j in range(width):
            if grid[i][j] == "#":
                q.append((i, j))
                distance[i][j] = 0
    answer = 0
    delta = ((0, 1), (1, 0), (0, -1), (-1, 0))
    while q:
        y, x = q.popleft()
        answer = distance[y][x]
        for dy, dx in delta:
            new_y = y + dy
            new_x = x + dx
            if 0 <= new_y < height and 0 <= new_x < width and distance[new_y][new_x] < 0:
                distance[new_y][new_x] = answer + 1
                q.append((new_y, new_x))
    print(answer)


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

import math
import itertools
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
GCD = 0
range_list = list(range(1, K+1))
iterator = itertools.product(range_list, range_list, range_list)
for (a, b, c) in iterator:
    GCD += gcd(a, b, c)

print(GCD)


### FIXED CODE ###

import math
import itertools
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
GCD = 0
range_list = list(range(1, K+1))
iterator = itertools.product(range_list, range_list, range_list)
for a in range(1, K+1):
    for b in range(a, K+1):
        for c in range(b, K+1):
            val= gcd(a, b, c)
            if a == b and b == c:
                GCD += val
            elif a == b or b == c:
                GCD += 3 * val
            else:
                GCD += 6 * val

print(GCD)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
s =0
M = 10**9 +7
for i in range(N-1):
  s += A[i] * sum(A[i+1:])
print(s%M)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
s =0
M = 10**9 +7
As = sum(A)
for i in range(N-1):
  As = As - A[i]
  s += (A[i] * As)%M
print(s%M)
### BUGGY CODE ###

N = int(input())
list_S = [input() for i in range(N)]
list_S.sort()
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a+1)
        a = 0
list_a.append(a+1)
newlist_a = sorted(list_a,reverse=True)
A = newlist_a[0]
n = newlist_a.count(A)
ans = ""
if n == 1:
    t = 0
    for i in range(list_a.index(A)):
        t += list_a[i]
    if N == 1:
        ans = list_S[t]
    else:
        ans = list_S[t+1]
else:
    if A==1:
        for i in range(len(list_S)):
            ans += list_S[i]
            ans += "\n"
    else:            
        list_t = []
        b = 0
        for i,x in enumerate(list_a):
            if x == A:
                list_t.append(sum(list_a[0:i]))
                ans += list_S[list_t[b]]
                ans += "\n"
                b += 1
print(ans)

### FIXED CODE ###

import collections

N = int(input())
S = [input() for i in range(N)]
c =collections.Counter(S)
C = c.most_common()
list_C = []
for i in range(len(c)):
    list_C.append(C[i][1])
m = 1
for i in range(len(list_C)-1):
    if list_C[i]==list_C[i+1]:
        m += 1
    else:
        break
ans= []
for i in range(m):
    ans.append(C[i][0])
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])
### BUGGY CODE ###

N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
for i in range(N):
    print(A.count(i+1))

### FIXED CODE ###

N = int(input())
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
    
l = [0]*N
for a in A:
    l[a-1]+=1
for sl in l:print(sl)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
counter = [0 for _ in range(n)]
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            if counter[i] > 0:
                continue
            else:
                if a[i] % a[j] == 0:
                    counter[i] += 1
print(counter.count(0))

### FIXED CODE ###

import numpy as np
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0 for _ in range(a[-1] + 1)]

for x in a:
    for j in range(x, a[-1] + 1, x):
        dp[j] += 1
ans = 0
for x in set(a):
    #print(x)
    if dp[x] == 1:
        ans += 1
print(ans)
### BUGGY CODE ###

N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        w=N*((i+j)/(i*j))/4
        if w==int(w):
            h=i
            n=j
            break
print(h,n,w)

### FIXED CODE ###

N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        bw=4*i*j-N*i-N*j
        if bw<=0:
            continue
        if (N*i*j)%bw==0:
            print(i,j,(N*i*j)//bw)
            exit()
### BUGGY CODE ###

n = int(input())
a = [0] + list(map(int, input().split())) + [0]
ans = 0
for i in range(1,n+1):
  l,r = i,i
  while a[l-1] > a[i]:
    l -= 1
  while a[r+1] > a[i]:
    r += 1
  ans += a[i]*(i-l+1)*(r-i+1)
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
p = [0]*(n+1)
ans = 0
for i in range(n):
  p[a[i]] = i+1
l = [i-1 for i in range(n+2)]
l[0] = 0
r = [i+1 for i in range(n+2)]
r[-1] = n+1
for i in range(n,0,-1):
  ans += (p[i]-l[p[i]])*(r[p[i]]-p[i])*i
  l[r[p[i]]] = l[p[i]]
  r[l[p[i]]] = r[p[i]]
print(ans)
### BUGGY CODE ###

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

import numpy as np
dp = np.zeros((N, N), dtype = 'int') - 1

for j in range(1, N):
    k = 0
    while j + k < N and S[k] == S[j + k]:
        k += 1
    dp[0][j] = k


for i in range(1, N):
    for j in range(i + 1, N):
        if dp[i - 1][j - 1] == 0:
            k = 0
            while j + k < N and S[i + k] == S[j + k]:
                k += 1
            dp[i][j] = k
        else:
            dp[i][j] = dp[i - 1][j - 1] - 1

res = 0
for i in range(1, N):
    for j in range(i + 1, N):
        res = max(res, min(j - i, dp[i][j]))
print(res)

### FIXED CODE ###

N = int(input())
S = input()
r = 1
ans = 0
for i in range(N):
    while True:
        if S.rfind(S[i : r + 1]) >= r + 1:
            r += 1
            ans = max(ans, r - i)
        else:
            break
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)
input=sys.stdin.readline

N = int(input())
par = {i:[] for i in range(1, N+1)}

for i in range(2, N+1):
    a = int(input())
    par[a].append(i)

def dfs(s):
    depth = 1
    res = []
    for t in par[s]:
        res.append(dfs(t))
    res.sort(reverse=True)
    for i, j in enumerate(res, start=1):
        depth = max(depth, i+j)
    return depth

print(dfs(1)-1)

### FIXED CODE ###

import sys
from functools import lru_cache
sys.setrecursionlimit(1000000)
input=sys.stdin.readline


N = int(input())
par = {i:[] for i in range(1, N+1)}

for i in range(2, N+1):
    a = int(input())
    par[a].append(i)

@lru_cache(maxsize=None)
def dfs(s):
    depth = 1
    res = []
    for t in par[s]:
        res.append(dfs(t))
    res.sort(reverse=True)
    for i, j in enumerate(res, start=1):
        depth = max(depth, i+j)
    return depth

print(dfs(1)-1)
### BUGGY CODE ###

n, k = map(int, input().split())
s = input()

on = []
off = []

acnt = 0
bcnt = 0
for i in s:
  if i == '0':
    if bcnt > 0:
      off.append(bcnt)
      bcnt = 0
    acnt += 1
  else:
    if acnt > 0:
      on.append(acnt)
      acnt = 0
    bcnt += 1
if bcnt > 0:
  off.append(bcnt)
  bcnt = 0
if acnt > 0:
  on.append(acnt)
  acnt = 0
ans = 0
if s[0] == '1':
  for i in range(len(on)-k+1):
    s = sum(on[i:i+k]) + sum(off[i:i+k+1])
    # print (sum(on[i:i+k]),sum(off[i:i+k+1]))
    ans = max(ans,s)
else:
  for i in range(len(on)-k+1):
    if i == 0:
      s = sum(on[i:i+k]) + sum(off[i:i+k])
      # print (sum(on[i:i+k]),sum(off[i:i+k]))
    else:
      s = sum(on[i:i+k]) + sum(off[i-1:i+k])
      # print (sum(on[i:i+k]),sum(off[i-1:i+k]))
    ans = max(ans,s)
if ans == 0:
  print (n)
else:
  print (ans)


### FIXED CODE ###

n, k = map(int, input().split())
s = input()

on = []
off = []

acnt = 0
bcnt = 0
for i in s:
  if i == '0':
    if bcnt > 0:
      off.append(bcnt)
      bcnt = 0
    acnt += 1
  else:
    if acnt > 0:
      on.append(acnt)
      acnt = 0
    bcnt += 1
if bcnt > 0:
  off.append(bcnt)
  bcnt = 0
if acnt > 0:
  on.append(acnt)
  acnt = 0
ans = 0
if s[0] == '1':
  for i in range(len(on)-k+1):
    s = 0
    if i == 0:
      a = sum(on[i:i+k])
      b = sum(off[i:i+k+1])
    else:
      a += on[i+k-1]
      a -= on[i-1]
      if i+k <= len(off)-1:
        b += off[i+k]
      b -= off[i-1]
    # print (a,b)
    s = a+b
    ans = max(ans,s)
else:
  for i in range(len(on)-k+1):
    if i == 0:
      a = sum(on[i:i+k])
      b = sum(off[i:i+k])
    elif i == 1:
      a = sum(on[i:i+k])
      b = sum(off[i-1:i+k])
    else:
      a += on[i+k-1]
      a -= on[i-1]
      if i+k-1 <= len(off)-1:
        b += off[i+k-1]
      b -= off[i-2]
    s = a+b
    # print (a,b)
    ans = max(ans,s)
if ans == 0:
  print (n)
else:
  print (ans)
### BUGGY CODE ###

N=int(input())
Ain=list(map(int,input().split())) 
ansn=0
A=set(Ain)
A=list(A)
A.sort()
A2=list(t for t in A)


ans=[]
while len(A2)!=0:
    ans.append(A2[0])
    temp=[]
    for facs in A2:
        if facs%A2[0]==0:
            temp.append(facs)
    for temps in temp:
        A2.remove(temps)

for anss in ans:
    if Ain.count(anss)==1:
        ansn+=1
print(ansn)

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
A.sort()
inf=10**6+1
t=[True for i in range(inf)]

ans=0
for j in range(N):
    if j+1<=N-1 and t[A[j]]:
        if A[j+1]!=A[j]:
            ans+=1
        else:
            t[A[j]]=False
        for numb in range(A[j],inf,A[j]):
            t[numb]=False
    elif j==N-1 and t[A[j]]:
        ans+=1

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

#!/usr/bin/python

if __name__ == "__main__":
	S = raw_input()
	c = ['A','B','C']
	
	while True:
		if S == "ABC":
			print "Yes"
			break
		
		T = S.strip().split("ABC")
		P = ''.join(T)
		
		cnt = 0
		for x in c:
			if x in P:
				cnt += 1
			else:
				S = x.join(T)
		
		if cnt != 2:
			print "No"
			break

### FIXED CODE ###

#!/usr/bin/python

if __name__ == "__main__":
	S = raw_input()
	c = ['A','B','C']
	
	while True:
		if len(S) <= 3:
			print "Yes" if S == "ABC" else "No"
			break
		
		T = S.strip().split("ABC")			
		P = ''.join(T)
		
		cnt = 0
		for x in c:
			if x in P:
				cnt += 1
			else:
				S = x.join(T)
		
		if len(T) == 1 or cnt != 2:
			print "No"
			break
### BUGGY CODE ###

import math
from functools import reduce
from itertools import product
 
x = int(input())
 
s = 0
for i in product(range(1, x+1), repeat=3):
  s += reduce(math.gcd, i)
print(s)

### FIXED CODE ###

import math
from itertools import product
 
x = int(input())

s = 0
for a, b, c in product(range(1, x+1), repeat=3):
  s += math.gcd(math.gcd(a, b), c)
print(s)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
  X,Y,Z = map(int, input().split())
  X -= 1
  Y -= 1
  G[X].append(Y)
  G[Y].append(X)
#print(G)

def dfs(u,v):
  for t in G[u]:
    #if t != v:
    if not Visited[t]:
      Visited[t] = True
      dfs(t,u)

Visited = [False for _ in range(N)]
ans = 0
for i in range(N):
  if not Visited[i]:
    Visited[i] = True
    ans += 1
    dfs(i,-1)
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
  X,Y,Z = map(int, input().split())
  X -= 1
  Y -= 1
  G[X].append(Y)
  G[Y].append(X)
#print(G)

def dfs(u,v):
  for t in G[u]:
    #if t != v:
    if not Visited[t]:
      Visited[t] = True
      dfs(t,u)

Visited = [False for _ in range(N)]
ans = 0
for i in range(N):
  if not Visited[i]:
    Visited[i] = True
    ans += 1
    dfs(i,-1)
print(ans)
### BUGGY CODE ###

import sys
x = int(input())

a = -1
judge = True
while(judge):
    a += 1
    if(a**5 <= x):
        b = 0
        while(a**5 - b**5 <= x):
            if (a**5 - b**5 == x):
                judge = False
                print(a, b)
                sys.exit(0)
                break
            b -= 1
            # print('1', a, b)
    if(a**5 - (a-1)**5 < x):
        b = 0
        while(a**5 - b**5 >= x):
            if (a**5 - b**5 == x):
                judge = False
                print(a, b)
                sys.exit(0)
                break
            b += 1
            # print('2', a, b)
    # print(a)
    # a += 1
print(a, b)


### FIXED CODE ###

import sys
import bisect
import numpy as np

x = int(input())
bs = [i for i in range(-100, 200)]
bspow = list(map(lambda x: x**5, bs))
# print(bspow)

for a in range(200):
    b_calc = a**5 - x
    index = bisect.bisect_left(bspow, b_calc)
    if(bspow[index] == b_calc):
        print(a, bs[index])
        sys.exit(0)