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

n=int(input())
a=list(map(int,input().split()))
a1=sorted(a)
ans=''
for i in range(n):
    for j in range(n):
        if a1[i]==a[j]:
            ans+=str(j+1)+' '
print(ans)

### FIXED CODE ###

n=int(input())
a=input().split()
ans=['' for _ in range(n)]
for i in range(n):
    s=int(a[i])
    ans[s-1]=str(i+1)
print(' '.join(ans))
### BUGGY CODE ###

def main():
    from bisect import bisect_left as bs
    n, m, *abc = map(int, open(0).read().split())
    a = sorted(abc[:n])
    *bc, = zip(*[iter(abc[n:])] * 2)
    bc = sorted(bc, key=lambda x: x[1], reverse=True)

    ans = 0
    for b, c in bc:
        i = bs(a, c)
        j = min(i, b)
        ans += j * c
        a = a[j:]

    print(ans + sum(a))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter
    n, m, *abc = map(int, open(0).read().split())
    a = Counter(abc[:n])
    bc = abc[n:]
    for i, j in zip(*[iter(bc)] * 2):
        a[j] += i

    cnt = n
    ans = 0
    keys = list(a.keys())
    keys.sort(reverse=True)

    for k in keys:
        m = a[k]
        if m <= cnt:
            ans += k * m
            cnt -= m
        else:
            ans += k * cnt
            break

    print(ans)


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

a,b,k=map(int,input().split())

nums=[i for i in range(a,b+1)]
nums2=sorted(nums,reverse=True)

if b-a+1<=2*k:
    for i in nums:
        print(i)

else:
    ans=[]
    for i in range(k):
        ans.append(nums[i])
        ans.append(nums2[i])
    ans=sorted(ans)
    for j in ans:
        print(j)


### FIXED CODE ###

a,b,k=map(int,input().split())

if b-a+1>=2*k:
    aa=[a+i for i in range(k)]
    bb=[b-i for i in range(k)]
    cc=sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for n in range(a,b+1):
        print(n)
### BUGGY CODE ###

def main():
    import sys
    mod = int(1e9+7)
    input=sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    #S[0]は使わない
    S = [[0]*60 for _ in range(N)]

    tmp = A[-1]
    idx = 0
    while tmp > 0:
        if tmp%2:
            S[-1][idx] += 1
        idx += 1
        tmp //= 2
    S[-1] = tuple(S[-1])

    for i in range(N-2, 0, -1):
        for j in range(60):
            S[i][j] = S[i+1][j]
        tmp = A[i]
        idx = 0
        while tmp > 0:
            if tmp % 2:
                S[i][idx] += 1
            idx += 1
            tmp //= 2
        S[i] = tuple(S[i])

    ans = 0
    for i in range(N-1):
        tmp = A[i]
        idx = 0
        while tmp > 0:
            if tmp % 2:
                ans += ((N-1-i)-S[i+1][idx])*2**idx

            else:
                ans += S[i+1][idx]*2**idx

            idx += 1
            tmp //= 2

        for x in S[i+1][idx:]:
            ans += x*2**idx%mod
            idx += 1

        ans %= mod

    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

mod = int(1e9+7)
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(60):
    a = 0
    b = 0
    for j in range(N):
        if A[j] % 2:
            a += 1
        else:
            b += 1
        A[j] //= 2
    ans += a*b*pow(2, i, mod)
    ans %= mod
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)
h,w=map(int,input().split())
s=[list(input())for i in range(h)]
a=[[float("inf")]*w for i in range(h)]
b=[[False]*w for i in range(h)]
def f(x,y,t):
    if 0<=x<h and 0<=y<w:
        if s[x][y]=="#":
            if b[x][y]==False:
                a[x][y]=0
                b[x][y]=True
                f(x,y+1,1)
                f(x+1,y,1)
                f(x-1,y,1)
                f(x,y-1,1)
        else:
            if a[x][y]>t:
                a[x][y]=t
                f(x,y+1,t+1)
                f(x+1,y,t+1)
                f(x-1,y,t+1)
                f(x,y-1,t+1)
for i in range(h):
    for j in range(w):
        if s[i][j]=="#":
            f(i,j,0)
            break
print(max(max(i)for i in a))

### FIXED CODE ###

import numpy as np
from scipy.ndimage import distance_transform_cdt as d
h,w=map(int,input().split())
s=[[1 if i=="." else 0 for i in input()]for i in range(h)]
a=d(s,metric='taxicab')
print(a.max())
### BUGGY CODE ###

from collections import deque
from copy import deepcopy
N, M, K = map(int, input().split())
SNS = [[0 for _ in range(N+1)] for __ in range(N+1)]
Follow = [deque() for __ in range(N+1)]
for _ in range(M):
  a, b = map(int, input().split())
  SNS[a][b] = 1
  SNS[b][a] = 1
  Follow[a].append(b)
  Follow[b].append(a)
for _ in range(K):
  a, b = map(int, input().split())
  SNS[a][b] = -1
  SNS[b][a] = -1

Chains = []
seen = [False]*(N+1)
i = 1
while i <= N:
  if not seen[i]:
    seen[i] = True
    chain = deque()
    q = deque(deepcopy(Follow[i]))
    memo = [False]*(N+1)
    while q:
      j = q.pop()
      if not memo[j]:
        memo[j] = True
        seen[j] = True
        chain.append(j)
        q += deepcopy(Follow[j])
    Chains.append(deepcopy(chain))
  i += 1
ans = [0] * (N+1)

for chain in Chains:
  l = len(chain)
  for hito in chain:
    n = 0
    for aite in chain:
      n += 0 if SNS[hito][aite] == 0 else 1
    ans[hito] = l - n -1
print(" ".join([str(a) for a in ans[1:]]))

### FIXED CODE ###

from collections import deque
from copy import deepcopy

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

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

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

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

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

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M, K = map(int, input().split())
UF = UnionFind(N+1)
direct_connect = [0]*(N+1)
for _ in range(M):
  a, b = map(int, input().split())
  UF.union(a, b)
  direct_connect[a] += 1
  direct_connect[b] += 1
for _ in range(K):
  a, b = map(int, input().split())
  if UF.same(a, b):
    direct_connect[a] += 1
    direct_connect[b] += 1
ans = ""
for i in range(1, N+1):
  ans += "%d "%(UF.size(i)-direct_connect[i]-1)
print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())
# 2237
H = list(map(int, input().split()))


dp = [float("inf")]*(n+2)
dp[0] = 0
for i in range(n):
    for j in range(1, k+1):
        if i+j >= n:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(H[i]-H[i+j]))

print(dp[n-1])


### FIXED CODE ###

n, k = map(int, input().split())
H = list(map(int, input().split()))


dp = [float("inf")]*(n+2)
dp[0] = 0
for i in range(n):
    for j in range(1, k+1):
        if i+j >= n:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(H[i]-H[i+j]))

print(dp[n-1])
### BUGGY CODE ###

N, M= map(int, input().split())
a =[str(input()) for _ in range(M)]
DP = [0]*(N+1)
num = 1000000007
DP[0] = 1
for i in range(N):
  if str(i) in a:
    DP[i] = 0
  else:
    if i < N:
      DP[i+1] += DP[i] % num
      if i < N-1:
        DP[i+2] += DP[i] % num
print(DP[-1]%num)

### FIXED CODE ###

N, M, = map(int, input().split())
a = set([int(input()) for _ in range(M)])
DP = [0]*(N+2)
num = 1000000007
DP[0] = 1
for i in range(N):
  if i in a:
    DP[i] = 0
  else:
    DP[i] = DP[i] % num 
    if i < N:
      DP[i+1] += DP[i]
      DP[i+2] += DP[i]
print(DP[-2]%num)
### BUGGY CODE ###

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

list_val = list(set(L))
list_size = []
for i in list_val:
    list_size.append(L.count(i))

max_size = max(list_size)

ans = []
while max(list_size) == max_size:
    max_idx = list_size.index(max_size)
    ans.append(list_val[max_idx])
    list_size[max_idx] = 0
print("\n".join(sorted(ans)))


### FIXED CODE ###

import collections

N = int(input())

s = [input() for i in range(N)]

c = collections.Counter(s)
max_n = max(c.values())

ans = []
for key, val in c.items():
  if val == max_n:
    ans.append(key)
print("\n".join(sorted(list(set(ans)))))
### BUGGY CODE ###

n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]

potential_ends =   [i[0] for i in a if i[1] == n]
potential_starts = [i[1] for i in a if i[0] == 1]

for p in potential_starts:
    if p in potential_ends:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


### FIXED CODE ###

n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]

# n, m = 3, 2
# a = [[1, 2], [2, 3]]

pot_starts = []
pot_ends = []

for i in a:
    if i[0] == 1:
        pot_starts.append(i[1])
    elif i[1] == n:
        pot_ends.append(i[0])

if set(pot_starts).intersection(pot_ends):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

import itertools

n=int(input())

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

count = 0

for x, y, z in itertools.combinations(t, 3):
    if x+y>z and y+z>x and z+x>y:
        count += 1
print(count)

### FIXED CODE ###

import bisect
N = int(input())
L = sorted([int(x) for x in input().split()])
cnt = 0
#print(L)
for i in range(N-2):
    for j in range(i+1, N-1):
        #print(i, j)
        #print(bisect.bisect_left(L, L[i]+L[j]))
        cnt +=  bisect.bisect_left(L, L[i]+L[j]) - (j+1)
print(cnt)
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
t = [list(input()) for _ in range(h)]
d = deque([(Ch, Cw)])
d2 = deque()
ans = 0
a = [(1,0),(-1,0),(0,1),(0,-1)]
b = range(-2, 3)

while True:
  # 移動A
  while len(d) != 0:
    Th, Tw = d.popleft()
    d2.append((Th, Tw))
    if (Th,Tw) == (Dh, Dw):
      print(ans)
      exit()
    for i, j in a:
      _h,_w = Th + i, Tw + j
      _p = (_h, _w)
      if 0 <= _h < h and 0 <= _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
        d.append(_p)
        visited[_h][_w] = 1
  # 移動B
  ans += 1
  while len(d2) != 0:
    Th, Tw = d2.popleft()
    for i in b :
      for j in b :
        _h,_w = Th + i, Tw + j
        _p = (_h, _w)
        if 0 <= _h < h and 0 <=  _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
          d.append(_p)
          visited[Th][Tw] = 1
  if len(d) == 0:
    print('-1')
    exit()


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
ans = 0
for i in range(h):
  temp = input()
  for j in range(w):
    t[i][j] = temp[j]

d = deque([(Ch, Cw)])
ans = 0
a = [(1,0),(-1,0),(0,1),(0,-1)]

while True:
  # 移動A
  stemp = set()
  while len(d) != 0:
    Th, Tw = d.popleft()
    # s.add((Th, Tw))
    visited[Th][Tw] = 1
    stemp.add((Th, Tw))
    if (Th,Tw) == (Dh, Dw):
      print(ans)
      exit()
    for i, j in a:
      _h,_w = Th + i, Tw + j
      _p = (_h, _w)
      if 0 <= _h < h and 0 <= _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
        d.append(_p)
        visited[_h][_w] = 1
  # 移動B
  ans += 1
  for Th,Tw in stemp:
    for i in range(-2, 3) :
      for j in range(-2, 3) :
        _h,_w = Th + i, Tw + j
        _p = (_h, _w)
        if 0 <= _h < h and 0 <=  _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
          d.append(_p)
  if len(d) == 0:
    print('-1')
    exit()
### BUGGY CODE ###

import math
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

cut = [1] *n
r = []
for i in a:
    r.append(i)

for i in range(k):
    max_value = max(r)
    max_index = r.index(max_value)
    cut[max_index] += 1
    r[max_index] = a[max_index] / cut[max_index]

print(math.ceil(max(r)))

### FIXED CODE ###

import math

n,k = map(int,input().split())
a = [int(i) for i in input().split()]

a.sort()
r = a[n-1]
l = 0


def calc(t,x):
    return math.ceil(t / x) - 1


while r - l > 1:
    mid = (r+l)//2
    count = 0
    for i in a:
        count += calc(i,mid)
    if count > k:
        l = mid
    else:
        r = mid

print(r)
### BUGGY CODE ###

from sys import stdin
input = stdin.readline


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

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

  score = []
  for i in range(K, N+1):
    score.append(S[i]/S[i-K])

  for i in range(1, len(score)):
    if score[i-1] < score[i]:
      print('Yes')
    else:
      print('No')


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


### FIXED CODE ###

from sys import stdin
input = stdin.readline


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

  # S = [1]*(N+1)
  # for i in range(1, N+1):
  #   S[i] = S[i-1] * A[i-1]

  # pre = S[K]/S[0]
  # out = []
  for i in range(K+1, N+1):
    if A[i-K-1] < A[i-1]:
      print('Yes')
    else:
      print('No')
    # temp = S[i]/S[i-K]
    # if pre < temp:
    #   # print('Yes')
    #   out.append('Yes')
    # else:
    #   # print('No')
    #   out.append('No')
    # pre = temp

  # print(*out, sep='\n')


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

import bisect
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]

for b,c in BC:
    A += [c] * b

# print(A)
# print(sorted(A))
# print(sorted(A)[-N:])
print(sum(sorted(A)[-N:]))

### FIXED CODE ###

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
BC = [list(map(int,input().split())) for _ in range(M)]
BC = sorted(BC, key=lambda x:x[1], reverse=True)
D = [0] * N
idx = 0
for b,c in BC:
    for i in range(b):
        D[idx] = c
        idx += 1
        if idx >= N:
            break
    if idx >= N:
        break
# print(D)


# print(D)
# print(sorted(A))
# print(len(D), len(A))
for i in range(N):
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break
print(sum(A))
### BUGGY CODE ###

import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

def main():
    n=int(input())
    a=[int(input()) for i in range(n-1)]
    # print(a)
    dic={}
    for i in range(n-1):
        p=a[i]
        if p in dic:
            dic[p].append(i+2)
        else:
            dic[p]=[i+2]


    lst=[-1]*(n+1)

    def solve(m):
        if lst[m]!=-1:
            return lst[m]
        tmp=[]
        if m in dic:

            for i in dic[m]:
                tmp.append(solve(i))
        tmp.sort(reverse=True)
        rtn=0
        for i in range(len(tmp)):
            rtn=max(rtn,tmp[i]+i+1)
        lst[m]=rtn
        return rtn

    solve(1)
    # print(lst)
    print(max(lst))
main()

### FIXED CODE ###

import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

def main():
    n=int(input())
    a=[int(input()) for i in range(n-1)]
    # print(a)
    dic={}
    for i in range(n-1):
        p=a[i]
        if p in dic:
            dic[p].append(i+2)
        else:
            dic[p]=[i+2]


    lst=[-1]*(n+1)

    def solve(m):
        if lst[m]!=-1:
            return lst[m]
        tmp=[]
        if m in dic:

            for i in dic[m]:
                tmp.append(solve(i))
        tmp.sort(reverse=True)
        rtn=0
        for i in range(len(tmp)):
            rtn=max(rtn,tmp[i]+i+1)
        lst[m]=rtn
        return rtn

    solve(1)
    # print(lst)
    print(max(lst))
main()
### BUGGY CODE ###

MOD = 10**9 + 7

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

ans = 0
for i in range(n-1):
    ans = (ans+(A[i]*sum(A[i+1:])%MOD)%MOD)%MOD
print(ans)

### FIXED CODE ###

MOD = 10**9 + 7
n = int(input())
A = list(map(int, input().split()))

import numpy
A_CS = numpy.cumsum(sorted(A, reverse=True))
A_CS = A_CS%MOD

A = sorted(A)

#print(A_CS)
ans = 0
for i in range(n-1):
#    print(A[i], A_CS[-i-2])
#    A_CS -= A[i]
    ans = (ans+(A[i]*A_CS[-i-2])%MOD)%MOD
print(ans)
### BUGGY CODE ###

from collections import deque
import sys
sys.setrecursionlimit(10**9)


N, K = map(int, input().split())
V = deque(list(map(int, input().split())))


def solve(v, k):
  if len(v) == 0 or k <= 0:
    return v, 0
  else:
    v0 = v.popleft()
    v, _a1 = solve(v, k-1)
    _a1 += v0
    v, _a2 = solve(v, k-2)
    v.appendleft(v0)
    v1 = v.pop()
    v, _a3 = solve(v, k-1)
    _a3 += v1
    v, _a4 = solve(v, k-2)
    v.append(v1)
    return v, max(_a1, _a2, _a3, _a4)

print(solve(V, K)[1])

### FIXED CODE ###

import bisect

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


ans = 0
R = min(N, K)
for r in range(R+1):
  for a in range(r+1):
    left = V[:a]
    b = r - a
    if b == 0:
      right = []
    else:
      right = V[-b:]
    
    v = left + right
    v.sort()
    n_nega = bisect.bisect_left(v, 0)
    k = min(n_nega, K-r)
    ans = max(ans, sum(v[k:]))


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

import sys

x =lambda:list(map(int,sys.stdin.readline().strip().split()))
n,m=x()
adjac = {i:[] for i in range(1,n+1)}

for _ in range(m):
    a,b = x()
    adjac[a].append(b)
    adjac[b].append(a)

comp = 0

visited = {i:False for i in range(1,n+1)}

for i in range(1,n+1):

    if not visited[i]:
        queue = [i]
        count=1
        visited[i] = True
        while len(queue)!=0:
            h=queue[0]
            queue.pop(0)
            arr = adjac[h]
            # print(arr,i)
            for j in arr:
                if not visited[j]:
                    # print(j,h)
                    visited[j]=True
                    queue.append(j)
                    count+=1
        comp=max(comp,count)
print(comp)

### FIXED CODE ###

import sys

x =lambda:list(map(int,sys.stdin.readline().strip().split()))
n,m=x()
adjac = {i:[] for i in range(1,n+1)}

for _ in range(m):
    a,b = x()
    adjac[a].append(b)
    adjac[b].append(a)

comp = 0

visited = {i:False for i in range(1,n+1)}

for i in range(1,n+1):

    if not visited[i]:
        queue = [i]
        count=1
        visited[i] = True
        while len(queue)!=0:
            h=queue[0]
            queue.pop(0)
            arr = adjac[h]
            # print(arr,i)
            for j in arr:
                if not visited[j]:
                    # print(j,h)
                    visited[j]=True
                    queue.append(j)
                    count+=1
        comp=max(comp,count)
print(comp)
### BUGGY CODE ###

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

li = []
is1s = False
if s[0] == "1":
    is1s = True
cnt0 = 0
cnt1 = 0
for i in range(len(s)):
    if s[i] == "0" :
        cnt0 += 1
    if s[i] == "1":
        cnt1 += 1
    if i >= 1:
        if s[i] == "0" and s[i-1] == "1":
            li.append(cnt1)
            cnt1 = 0
        if s[i] == "1" and s[i-1] == "0": 
            li.append(cnt0)
            cnt0 = 0

if (cnt1 > 0):
    li.append(cnt1)
if (cnt0 > 0):
    li.append(cnt0)
pivot = 2 * k 
anslist=[]
if(is1s):
    for i in range(len(li)):
        if(i % 2 == 0):
            tmp = sum(li[i:min(len(li), i+pivot+1)])
            anslist.append(tmp)
else:
    for i in range(len(li)):
        if(i % 2 == 1):
            tmp = sum(li[i:min(len(li), i+pivot+1)])
            anslist.append(tmp)
    anslist.append(sum(li[0:pivot]))

print(max(anslist))



### FIXED CODE ###

import numpy as np
n,k = map(int,input().split())	
s=list(input())	

li = []
is1s = False
if s[0] == "1":
    is1s = True
cnt0 = 0
cnt1 = 0
for i in range(len(s)):
    if s[i] == "0" :
        cnt0 += 1
    elif s[i] == "1":
        cnt1 += 1
    if i >= 1:
        if s[i] == "0" and s[i-1] == "1":
            li.append(cnt1)
            cnt1 = 0
        elif s[i] == "1" and s[i-1] == "0": 
            li.append(cnt0)
            cnt0 = 0

if (cnt1 > 0):
    li.append(cnt1)
if (cnt0 > 0):
    li.append(cnt0)
pivot = 2 * k 
li = np.array(li)
anslist=[]
if(is1s):
    for i in range(len(li)):
        if(i % 2 == 0):
            tmp = np.sum(li[i:min(len(li), i+pivot+1)])
            anslist.append(tmp)
else:
    for i in range(len(li)):
        if(i % 2 == 1):
            tmp = np.sum(li[i:min(len(li), i+pivot+1)])
            anslist.append(tmp)
    anslist.append(sum(li[0:pivot]))

print(max(anslist))
### BUGGY CODE ###

def choose2(number):
	if number>=2:
		return (number*(number-1))/2
	else:
		return 0
N = int(input())
klist = input()
k = []
for x in range(N-1):
	k.append(int(klist[:klist.index(" ")]))
	klist = klist[klist.index(" ")+1:]
k.append(int(klist))
valArr = list(set(k))
occurence = []
for i in range(len(valArr)):
	occurence.append(0)
for j in range(N):
	for x in range(len(valArr)):
		if k[j]==valArr[x]:
			occurence[x]+=1
for ball in range(len(k)):
	ans = 0
	for time in range(len(occurence)):
		if k[ball]==valArr[time]:
			ans+=choose2(occurence[time]-1)
		else:
			ans+=choose2(occurence[time])
	print(int(ans))


### FIXED CODE ###

def choose2(number):
	if number>=2:
		return (number*(number-1))/2
	else:
		return 0
N = int(input())
k = list(map(int,input().split()))
valArr = list(set(k))
occurence = []
occurenceIndex = []
mx = 0
for l in k:
	if l>mx:
		mx=l
for i in range(mx+1):
	occurence.append(0)
for j in range(N):
	occurence[k[j]]+=1
	
			
'''6*5/2
5*4/2
N*(N-1)/2
(N-2)*(N-1)/2
N*(N-1)/2*(N-2)/N
occurence = [1,2,3]
ans = 0+2*1/2+3*2/2
k val = 3
correct = 0+2*1/2+2*1/2

'''
ans = 0
for time in range(len(occurence)):
	ans+=choose2(occurence[time])
for ball in range(N):
	kans = ans-choose2(occurence[k[ball]])+choose2(occurence[k[ball]]-1)
	
	print(int(kans))
### BUGGY CODE ###

from collections import Counter
# from numba import jit

def main():
    n = int(input().strip())
    L = list(map(int, input().strip().split()))
    seen = Counter()
    
    
    for x in L:
        seen[x]+=1
    
    def loop():
        ans=0
        for x in L:
            if seen[x]>1 or x!=1 and 1 in seen:
                continue
        
            tmp=2
            while tmp**2<=x:
                if x%tmp==0 and (tmp in seen or x/tmp in seen):
                    break
                tmp+=1
            else:
                ans+=1
        return ans
    print(loop())
# print(ans)
    
if '__main__' == __name__:
    main()

### FIXED CODE ###

def main():
    n = int(input().strip())
    L = list(map(int, input().strip().split()))
    L.sort()
    max_=L[-1]
    isDivisible = [False]*(max_) # 1-Lmax
    
    for i,x in enumerate(L):
        if i!=n-1 and x==L[i+1]:
            isDivisible[x-1]=True
            continue
        j=2*x
        while j<=max_:
            isDivisible[j-1]=True
            j+=x
    ans=0
    for x in L:
        if not isDivisible[x-1]:
            ans+=1
    print(ans)
# print(ans)
    
if '__main__' == __name__:
    main()