peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
s = set(A)
F = [False]*(10**6+100)
cnt = Counter(A)

for i in range(10**6+100):
    if i in s:
        F[i] = True

for i in range(1, 10**6+100):
    if i in s:
        for j in range(2*i, 10**6+100, i):
            F[j] = False
    
ans = 0

for i in range(10**6+100):
    if F[i] and cnt[i]==1:
        ans += 1

print(ans)
#!/usr/bin/env python3

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

A.sort()
A_max = A[-1]
table = [0] * (A_max + 1)

for x in A:
    table[x] += 1
    for y in range(x * 2, A_max + 1, x):
        table[y] += 1

result = sum([1 for x in A if table[x] == 1])
print(result)
n=int(input())
A=list(map(int,input().split()))
dp=[0]*(10**6+1)
for i in A:
  dp[i]+=1
for i in range(1,10**6+1):
  if dp[i]>0:
    for j in range(2*i,10**6+1,i):
      dp[j]=0
print(dp.count(1))
#coding:utf-8

N = int(input())

A = [int(y) for y in input().split()]

M = max(A)

L1 = [False] * (M+1)
L2 = [0] * (M+1)

for i in A:
    if L2[i] == 1:
        L1[i] = True
    
    d = i * 2
    L2[i] = 1
    
    while d <= M:
        L1[d] = True
        d += i

count = 0

for i in A:
    if not L1[i]:
        count += 1

print("{}".format(count))
n = int(input())
A = [*map(int, input().split())]
mx = max(A)
c = [0]*(mx+1)
for a in A:
    for i in range(a, mx+1, a): c[i] += 1
ans = 0
for a in A:
    if c[a] == 1: ans += 1
print(ans)
import sys
import math
def input(): return sys.stdin.readline().rstrip()
from decimal import Decimal

M = 10 ** 6 + 5
N = int(input())
A = list(map(int, input().split()))

count = [0] * M
for a in A:
    if count[a] != 0:
        count[a] = 2
        continue
    for i in range(1, M):
        if i * a >= M:
            break
        count[a*i] += 1

ans = 0
for a in A:
    if count[a] == 1:
        ans += 1
    
print(ans)
# Problem D - Not Divisible
# input
N = int(input())
a_nums = list(map(int, input().split()))

# initialization
max_a = max(a_nums)
fact_list = [0] * (max_a + 1)
ans = 0

# count
for a in a_nums:
    tmp = max_a // a
    for i in range(tmp):
        fact_list[a*(i+1)] += 1

# count 2
for a in a_nums:
    if fact_list[a]==1:
        ans += 1

# output
print(ans)
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)

s = A[-1]
p = [0 for _ in range(s+1)]
for i in A:
    p[i] += 1
    if p[i] > 1:
        continue
    for j in range(i*2,s+1,i):
        p[j] += 1
ans = 0
for i in A:
    if p[i] == 1:
        ans += 1
print(ans)
INF=10**6+1
n,*l=map(int,open(0).read().split())
from collections import *
c=Counter(l)
l=sorted(c.keys())
a=[]
b=[0]*INF
for i in l: b[i]=1  
for i in l:
  if b[i]:
    if c[i]<2: a+=[i]
    for j in range(2*i,INF,i): b[j]=0
print(len(a))
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
a.sort()

flg = [True for _ in range(10 ** 6 + 1)]
for i in range(n-1):
    if a[i] == a[i+1]:
        flg[a[i]] = False

ans = 0
for x in set(a):
    if flg[x]:
        ans += 1

    tmp = 1
    while tmp * x <= 10 ** 6:
        flg[tmp * x] = False
        tmp += 1

print(ans)
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
M = max(a)
cands = [0]*M

ans = 0
for num in a:
    if cands[num-1] >= 2:
        continue
    for i in range(num, M+1, num):
        cands[i-1] += 1
        
for num in a:
    if cands[num-1]==1:
        ans+=1
print(ans)
N = int(input())
 
A_list = [int(n) for n in input().split()]
 
import numpy as np
 
A_array = np.array(A_list)
sort_A = np.sort(A_array)

n_array = np.zeros(10**6)
  
for a in sort_A:
    
    if n_array[a - 1] >= 2:
        continue
        
    a_times = np.array(range(a, 10**6+1, a))
    
    n_array[(a_times -1).astype(int)] += 1

print((n_array[sort_A - 1] == 1).sum())
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

	

from collections import Counter
import bisect
N = int(input())
A = list(map(int,input().split()))
cnt = Counter(A)
A.sort()
ans = 0
MX = 10**6
P = [0] * (MX+1)
for a in A:
    if P[a]==0:
        for i in range(MX+1):
            x = a*i
            if x > MX:
                break
            P[x] = 1
        if cnt[a]==1:
            ans+=1
print (ans)
import numpy as np
n=int(input())
a=[int(j)for j in input().split()]+[10**7]
l=np.zeros(max(a)+1)
a.sort()
r=0
for i,j in zip(a,a[1:]):
    if l[i]==0:
        l[::i]=1
        if i!=j:
            r+=1
print(r)
N = int(input())
A = list(map(int, input().split()))
A.sort()
Amax = A[-1]
dp = [1]*(Amax+1)
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:
    for q in range(Amax//p+1):
      dp[p*q] = 0
    if A[i] != A[i+1]: 
      ans += 1
if dp[Amax] == 1:
  ans += 1
print(ans)
import sys
from collections import Counter
N = int(input())
As = list(map(int,input().split()))
ct = Counter(As)
As =sorted(As)
max_dp = As[-1] +1
dp = [True] * max_dp
for key,count in ct.items():
	if count > 1:
		dp[key] = False
		i = 2
		while key*i < max_dp:
			dp[key*i] = False
			i+=1
for A in As:
	if dp[A] == True:
		i = 2
		while A*i < max_dp:
			dp[A*i] = False
			i+=1

ans = 0
# print(len(dp))
for A in As:
	# print(A)
	if dp[A]:
		ans+=1
print(ans)
n = int(input())
a = list(map(int, input().split()))

a.sort()

M = 1000005
cnt = [0] * M

for i in range(n):
    if cnt[a[i]] != 0:
        cnt[a[i]] = 2
        continue
    for j in range(a[i], M, a[i]):
        cnt[j] += 1

ans = 0

for i in range(n):
    if cnt[a[i]] == 1:
        ans += 1

print(ans)
n=int(input())
a=list(map(int,input().split()))
a.sort()
dp=[True]*a[-1]
def hantei(i):
    ans = True
    if i!=n-1:
        if a[i]==a[i+1]: ans = False
    if i!=0:
        if a[i]==a[i-1]: ans=False
    return ans
for val in set(a):
    for i in range(2*val,a[-1]+1,val): dp[i-1]=False
ans=0
for i in range(n):
    if dp[a[i]-1] and hantei(i)==1: ans+=1
print(ans)
n = int(input())
A = list(sorted(list(map(int,input().split()))))

D=set()
S=set()
for i in range(n):
    if A[i] in S:
        D.add(A[i])
    else:
        S.add(A[i])

biggest = max(S)
dp = [1 for i in range(biggest+1)]
for i in S:
  if i in D:
    dp[i] = 0
  for j in range(2*i,biggest+1,i):
    dp[j] = 0

ans = 0
for i in A:
  ans += dp[i]
print(ans)
n = int(input())
a = list(map(int, input().split()))

table = [0 for i in range(10**6 + 1)]
ans = 0
a.sort()
a.append(10**7)
for i in range(n):
    el = a[i]
    if table[el] != 0:
        continue
    else:
        if el != a[i + 1]:
            ans += 1
    idx = el
    while idx <= 10**6:
        table[idx] += 1
        idx += el

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

limit = 10**6 + 2
A += [limit]
dp = [True] * (limit)

ans = 0
for i in range(n):
  a = A[i]
  if dp[a] and a != A[i+1]:
    ans += 1
  
  if dp[a] == False:
    continue
  for t in range(a,limit,a):    
    dp[t] = False
    t += a

print(ans)
from collections import Counter

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

MAX = 10 ** 6 + 10
multiples = [0] * MAX

for a in list(set(A)):
    for j in range(a * 2, MAX, a):
        multiples[j] = 1

d = Counter(A)
dup = [k for k, v in d.items() if v > 1]
for i in dup:
    multiples[i] = 1

ans = 0
for i in A:
    if multiples[i] == 0:
        ans += 1
print(ans)
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n = int(input())
  la = sorted(list(map(int, input().split())))
  a_max = max(la)
  dp = numpy.ones(a_max + 1)
  counts = numpy.zeros(a_max + 1)
  for a in la:
    counts[a] += 1
    if counts[a] < 2:
      dp[2*a::a] = 0
  print(len([a for a in la if dp[a]==1 and counts[a] == 1]))

if __name__=='__main__':
  main()
n = int(input())
a = sorted(list(map(int,input().split())))
m = a[-1]
b = [True]*(m+1)
for i in range(n):
    if i > 0 and a[i] == a[i-1]:
        continue
    for j in range(2, m//a[i]+1):
        b[j*a[i]] = False
ans = 0
for i in range(n):
    if 0 < i and a[i] == a[i-1]:
        continue
    if i < n-1 and a[i] == a[i+1]:
        continue
    if b[a[i]]:
        ans += 1
print(ans)
N = int(input())
A = list(map(int,input().split())) 
A.sort()
mx = A[-1]
E = [False]*(mx + 3)
ans = 0
A += [float("inf")]*2
for i in range(N):
    a = A[i]
    if not(E[a]) and A[i+ 1] != A[i]:
        ans += 1
    for j in range(1,(mx // a )+ 1):
        E[a*j] = True

print(ans)
# D - Not Divisible
def main():
    N, *A = map(int, open(0).read().split())
    lim = max(A) + 1
    sieve = [0] * lim
    for a in A:
        sieve[a] += 1
        if sieve[a] > 1:
            continue
        for i in range(a * 2, lim, a):
            sieve[i] = 2
    print(sum(sieve[a] == 1 for a in A))


if __name__ == "__main__":
    main()
from collections import Counter

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

max_ = 10 ** 6 + 1
b = [True] * (max_ + 1)
data.sort()
c = Counter(data)

ans = 0
for d in data:
    if b[d]:
        for j in range(d, max_, d):
            b[j] = False
        # 複数存在
        if c[d] > 1:
            continue
        else:
            ans += 1

print(ans)
N=int(input())
A=list(map(int,input().split()))
A.sort()
max_a=A[-1]
dp=[True]*(max_a+1)
ans=0
for i in range(N):
  a=A[i]
  #print(a)
  if dp[a]==True: 
    if i==N-1:
      ans+=1
    elif a!=A[i+1]:
      ans+=1
    
    k=a
    while k<=max_a:
      dp[k]=False    
      k+=a
print(ans)
bun = input()
lst = input().split()
nlst = []
for i in range(1000000):
    nlst.append(0)
for i in range(len(lst)):
    nlst[int(lst[i])-1] += 1
for i in range(1000000):
    if nlst[i] > 0:
        for j in range((i+i+1),1000000,i+1):
            nlst[j] = 0
count = 0
for i in range(1000000):
    if nlst[i] == 1 :
        count += 1
print(count)
def I(): return int(input())
def LI(): return list(map(int, input().split()))


n = I()
a = LI()
cnt = [0] * ((10 ** 6) + 1)
for elem in a:
    cnt[elem] += 1

unique = []

for i in range((10 ** 6) + 1):
    if cnt[i] == 1:
        unique.append(i)

cnt = [0] * ((10 ** 6) + 1)

a = list(set(a))

for elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

ans = 0

for elem in unique:
    if cnt[elem] == 0:
        ans += 1

print(ans)
n=int(input())
a=list(map(int,input().split()))
dp=[0]*(10**6+1)
for i in a:
  dp[i]+=1
for i in range(1,10**6+1):
  if dp[i]:
    for  j in range(2*i,10**6+1,i):
      dp[j]=0
print(dp.count(1))
#!/usr/bin/env python3
import sys
import collections

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


N = I()
A = LI()
A.sort()
cnt = collections.Counter(A)
end = A[-1] + 1

for a in A:
    if cnt[a] >= 2:
        del cnt[a]
    for i in range(a * 2, end, a):
        del cnt[i]

print(sum(cnt.values()))
n = int(input())
a = list(map(int, input().split()))
a.sort()

amax = a[-1]
dp = [True] * (amax+1)
ans = 0
for x in range(len(a)-1):
   i = a[x]
   if dp[i] == True:
      for j in range(amax//i+1):
         dp[i*j] = False
      if a[x] != a[x+1]:
         ans += 1
if dp[amax] == 1:
   ans += 1
print(ans)
from collections import Counter

def board(dp, i):
  m = 1
  while i*m <= len(dp)-1:
    dp[i*m]=False
    m+=1

a=int(input())
b=[int(x) for x in input().split()]
b=sorted(b)
d=Counter(b)
dp=[True]*(b[-1]+1)
c=0
for i in b:
  if dp[i] and d[i] < 2:
    c+=1
  board(dp, i)
print(c)
from collections import Counter

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

A.sort()

count = Counter(A)

divisible = [False] * (max_a + 1)

ans = 0

for a in A:
    if divisible[a]:
        continue
    for i in range(1, max_a // a + 1):
        divisible[i * a] = True
    if count[a] == 1:
        ans += 1
print(ans)
from collections import Counter

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

A.sort()
A_counter = Counter(A)

dp = [True for _ in range(10**6+1)]
for a in A_counter:
    if dp[a] == False:
        continue
    for j in range(a*2, 10**6+1, a):
        dp[j] = False

c = 0
for a, v in A_counter.items():
    if dp[a] and v == 1:
        c += 1

print(c)
import sys
import numpy as np
from collections import Counter

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

VALID = np.ones((10 ** 6) + 10, dtype=np.bool)

A.sort()
C = Counter(A)

multi = []
for k, v in C.items():
    if v > 1:
        multi.append(k)

for x in multi:
    VALID[x::x] = False


ans = 0
for a in A:
    if VALID[a]:
        ans += 1
        VALID[a::a] = False

print(ans)
n = int(input())
As = map(int, input().split())
from collections import defaultdict
dic = defaultdict(int)
for a in As:
  dic[a] += 1


table = [0] * (10**6+5)
for a, v in dic.items():
  for i in range(a, 10**6+5, a):
    table[i] += 1
ans = 0
for k, v in dic.items():
  if table[k] >= 2 and v == 1:
    ans += 1
  elif v >= 2:
    ans += v
print(n-ans)
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
A.sort()
M = A[-1]
divisible = [False] * (M + 1)
ans = 0
for i, a in enumerate(A):
    if not (i < N - 1 and A[i+1] == a) and not divisible[a]:
        ans += 1
    for b in range(a, M + 1, a):
        divisible[b] = True
print(ans)
from collections import Counter

N = int(input())
A = [int(Ai) for Ai in input().split()]

counter = Counter(A)

dp = [1] * (max(A) + 1)
for Ai in A:
    for j in range(Ai * 2, len(dp), Ai):
        dp[j] = 0

print(sum([dp[Ai] == 1 and counter[Ai] == 1 for Ai in A]))
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
mx = max(a)

c = Counter(a)
nu = {k for k, v in c.items() if v > 1}

s = set()
u = set()
for aa in a:
    m = 2
    if aa in s or aa in u:
        continue
    u.add(aa)
    while aa*m <= mx:
        s.add(aa*m)
        m += 1

o = 0
for aa in a:
    if aa in s or aa in nu:
        continue
    o += 1

print(o)
import numpy as np
from collections import Counter


len_arr = int(input())
arr = list(map(int, input().split(' ')))
counter = Counter(arr)
x_max = max(counter.keys())

dp = np.empty(x_max+1, dtype=np.bool_)
dp[:] = True

ans = 0

for x, count in sorted(counter.items()):
    multi = [x*y for y in range(1, x_max//x+1)]
    if count == 1 and dp[x]:
        ans += 1
    dp[multi] = False

print(ans)
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [True for _ in range(a[-1] + 1)]
pre = -1
for i in a:
    if i == pre:
        dp[i] = False
        continue
    for j in range(i * 2, a[-1] + 1, i):
        dp[j] = False
    pre = i
ans = 0
for i in a:
    if dp[i] == True:
        ans += 1
print(ans)
import numpy as np


def main():
    input()
    a = [int(i) for i in input().split()]
    a.sort()
    dp = np.zeros(a[-1] + 1, dtype=np.int)
    for ai in a:
        if dp[ai] == 0:
            dp[ai] = 1
            dp[ai * 2:a[-1] + 1:ai] = 2
        else:
            dp[ai] = 2
    # print(dp)
    print(len(dp[dp == 1]))


if __name__ == '__main__':
    main()
n = int(input())
a = list(map(int, input().split()))
s = ([0]*1000001)
a.sort()
for i in a:
    s[i] += 1
ans = 0
for j in range(1000001):
    if s[j] == 1:
        ans += 1
    if s[j] > 0:
        for k in range(j, 1000001, j):
            s[k] = 0
print(ans)
import numpy as np
import math
import collections
import bisect
from collections import Counter


N = int(input())

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

A.sort()
Set = set()

Amax = A[len(A) - 1]

counter = Counter(A)
ans = 0
for a in A:
    if a in Set:
        continue
    x = a
    while(x <= Amax):
        Set.add(x)
        x += a

    if counter[a] == 1:
        ans += 1

print(ans)
from collections import Counter
import bisect
N = int(input())
A = list(map(int,input().split()))



cnt = Counter(A)
A.sort()
ans = 0
P = [0] * (10**6+1)
#print(cnt)
for a in A:
    if P[a]==0:
        for i in range(10**7):
            x = a*i
            if x>10**6:
                break
            P[x] = 1
        if cnt[a]==1:
            ans +=1

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

dp = [0] * (10**6+1)

for a in A:
    dp[a] += 1

for i in range(1, len(dp)):
    if dp[i]:
        for j in range(i+i, len(dp), i):
            dp[j] = 0
print(dp.count(1))
n = int(input())
a = list(map(int, input().split()))

b = [0] * (max(a) + 1)
# b[i] = (aの要素がiであるような数)
for i in range(n):
    b[a[i]] += 1

ans = 0
for i in range(1, len(b)):
    if b[i] > 0:
        if b[i] == 1:
            ans += 1
        # print(i, ans)
        for j in range(len(b)):
            if i * j >= len(b):
                break
            b[i * j] = 0

print(ans)
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * (10 ** 6 + 1)

for i in range(n):
    cnt[a[i]] += 1

a_uniq = []

for i in range(10 ** 6 + 1):
    if cnt[i] == 1:
        a_uniq.append(i)

cnt = [0] * (10 ** 6 + 1)

for i in list(set(a)):
    for j in range(2 * i, 10 ** 6 + 1, i):
        cnt[j] = 1

ans = 0

for i in a_uniq:
    if cnt[i] == 0:
        ans += 1

print(ans)
from collections import Counter


n = int(input())
a = list(map(int, input().split()))
c = Counter(a) # Count num and construct dictionary
c = sorted(c.items(), key=lambda x:x[0]) # align key
ans = 0
isOK = [True] * (10**6+1)

for k, v in c:
    if not isOK[k]:
        continue

    if v > 1:
        for i in range(k, len(isOK), k):
            isOK[i] = False
        continue

    ans += 1
    for i in range(2*k, len(isOK), k):
        isOK[i] = False

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

num = [0] * (10**6+10)
A.sort()
for a in A:
    if num[a]==1:
        num[a] = -1
    elif num[a] ==0:
        num[a]+=1
        for i in range(2,(A[n-1]//a)+1):
            num[i*a]=-1

print(num.count(1))
from collections import Counter

n = int(input())
a = list(map(int,input().split()))
A = list(set(a))
A.sort()
amax = A[-1]
sieve = [1]*(amax+1)
ans = []

for i in A:
  for j in range(2,amax//i + 1):
    sieve[i*j] = 0

for i in A:
  if sieve[i] == 1:
    ans.append(i)

c = Counter(a)
ansl =len(ans)

for k,v in c.items():
  if sieve[k] == 1 and v >= 2:
    ansl -= 1
    
print(ansl)
n = int(input())
a = list(map(int,input().split()))
m =max(a)
arr = [0]*(m+1)

for i in a:
  for j in range(i,m+1,i):
    arr[j]+=1

cnt = 0
for i in a:
  if arr[i] ==1:
    cnt += 1

print(cnt)
import sys
input = sys.stdin.readline

n = int(input())
a = [int(x) for x in input().split()]
maxval = 10 ** 6
factor_cnt = [0] * (maxval+1)
for i in range(n):
    if factor_cnt[a[i]] > 1:
        continue
    for k in range(a[i], maxval+1, a[i]):
        factor_cnt[k] += 1

result = sum(factor_cnt[v] <= 1 for v in a)
print(result)
def main():
  N=input()
  A=sorted(map(int,input().split()))
  M=A[-1]+1
  B=[0]*M
  for i in A:
    B[i]+=1
    if B[i]==1:
      for j in range(i*2,M,i):
        B[j]=2
  print(B.count(1))
main()
n=int(input())
A=sorted(list(map(int,input().split())))
B=[0]*(1+A[-1])
for i in A:
    B[i]+=1
    if B[i]==1:
        for j in range(2*i,A[-1]+1,i):
            B[j]+=1
    else:
        continue
ans=0
for i in A:
  if B[i]==1: ans+=1

print(ans)
import sys
readline = sys.stdin.readline

import numpy as np
from collections import Counter
from numba import njit




N = int(input())
A = np.array(readline().split(), np.int32)

count = np.zeros((A.max() + 1))
for a in A:
    if count[a] > 1:
        continue
    count[::a] += 1

ret = 0
for a in A:
    ret += count[a] == 1

print(ret)
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = lr()
A.sort()
bl = np.array([True] * (A[-1]+1), dtype=np.bool)
answer = 0
for i, a in enumerate(A):
    if i < N-1 and A[i+1] == a:
        pass
    elif bl[a]:
        answer += 1
    if bl[a]:
        bl[a::a] = False

print(answer)
import sys
from collections import Counter

input = sys.stdin.readline
MAX_A = 10 ** 6


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

    A.sort()
    divisible = [False] * (MAX_A + 1)
    ans = 0
    for k, v in Counter(A).items():
        if v == 1 and not divisible[k]:
            ans += 1
        for i in range(k, MAX_A + 1, k):
            divisible[i] = True

    print(ans)


if __name__ == "__main__":
    main()
import numpy as np

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

num_array = np.zeros(max(a_list)+1)
for a in a_list:
    num_array[a::a] += 1
    
count = 0
for a in a_list:
  if num_array[a] == 1:
    count += 1
print(count)
n=int(input())
m=list(map(int,input().split()))
k=10**6+1
p=[0]*k
m.sort()
for i in range(1,n):
    if m[i]==m[i-1]:
        p[m[i]]=1
res=0
for i in range(n):
    if p[m[i]]==0:
        res+=1
    
    if i!=n-1 and m[i]!=m[i+1]:
        for j in range(m[i]*2,k,m[i]):
            p[j]=1
print(res)
#15:34
n = int(input())
a = list(map(int,input().split()))
a.sort()
b = [0 for _ in range(10**6+1)]
ans = 0
for i in range(n):
  if b[a[i]]:
    continue
  now = int(a[i])
  ans += 1
  while True:
    try:
      b[now] = 1
      now += a[i]
    except:
      break
  if i != n-1:
    if a[i+1] == a[i]:
      ans -= 1
print(ans)
import collections
n = int(input())
a = list(map(int, input().split()))

a.sort()

ma = max(a)
f = [1] * (ma + 1)

count = collections.Counter(a)
ans = 0

for i in a:
    if f[i]:
        if count[i] == 1:
            ans += 1
        for j in range(i, min(ma + i, ma + 1), i):
            f[j] = 0

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

from collections import Counter
C = Counter(A)
#print(C)

M = max(A)
X = [0]*(M+1)
for i in A:
    j = i*2
    while j <= M:
        X[j] = 1
        j += i
#print(X)

ans = 0
for a in A:
    if C[a] == 1 and X[a] != 1:
        ans += 1
print(ans)
import collections

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

dp = collections.defaultdict(lambda: True)

for i in range(N):
    if i < N - 1 and A[i] == A[i + 1]:
        dp[A[i]] = False
    k = 2
    while True:
        if A[i] * k > A[-1]:
            break
        else:
            dp[A[i] * k] = False
            k += 1

print(sum(dp[a] for a in A))
n = int(input())
a = list(map(int, input().split()))

maxA = max(a)
dp = [0]*(maxA+1)
count = 0

for e in a:
    for i in range(e,maxA+1,e):
        dp[i] += 1

for e in a:
    if dp[e] == 1:
        count += 1

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

A.sort(reverse=True)

ans = 0
for i, a in enumerate(A):
    flag = True
    for j in A[i + 1:]:
        if a % j == 0:
            flag = False
            break

    if A[i] == A[i - 1]:
        if A[i] % A[i - 1] == 0:
            flag = False

    if flag:
        ans += 1

print(ans)
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
binary_list = [1 for i in range(n)]
#print(a_list)

for i in range(n):
    if binary_list[i]==1:
        for k in range(i+1, n):
            if a_list[k]%a_list[i]==0:
                binary_list[k] = 0

if a_list[0] in a_list[1:]:
    binary_list[0] = 0

print(sum(binary_list))
N = int(input())
num_list = list(map(int, input().split()))
count=0
for i in range(N):
  for j in range(N):
    if num_list[i] % num_list[j]==0:
      count = count + 1
      break
count = count - N
print(N-count)
N = int(input())
A = list(map(int,input().split()))
dev = []
count = 1
A = sorted(A, reverse = True)
for i in range(N-1):
  flag = 0
  for j in range(i+1, N):
    if A[i] % A[j] == 0:
      flag = 1
      break
  
  if flag == 0:
    count +=1
l = len(A)
if A[l-1] == A[l-2]:
  count -=1
print(count)
N = int(input())
a = list(map(int,input().split()))
A = sorted(a, reverse=True)
count = 0
for i in range(N-1):
  flag = False
  for j in range(i+1,N):
    if i != j:
      if A[i] % A[j] == 0:
        flag = True
        break
  if flag == False:
    count += 1
print(count)
N = int(input())
A = list(map(int,input().split()))
cnt = 0
cnt2 = 0
for i in A:
    for j in A:
        if i != j:
            if i%j == 0:
                cnt += 1
    if i != j:
        if cnt == 0:
            cnt2 += 1
    cnt = 0
print(cnt2)