CodeEff/ECCO huggingface dataset:
# Original solution
import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(eval(input()))
    A = sorted(list(map(int, input().split())))
    D = Counter(A)

    B = []
    W = set()
    for k, v in list(D.items()):
        if v == 1:
            B.append(k)
        else:
            W.add(k)

    res = 0
    for a in A:
        for i in range(1, int(pow(a, 0.5)) + 1):
            if a % i == 0:
                if i in W or a // i in W:
                    break
        else:
            res += 1
        W.add(a)
    print(res)


if __name__ == '__main__':
    resolve()


# Optimized solution
import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(eval(input()))
    A = sorted(list(map(int, input().split())))
    D = Counter(A)

    dup = set()
    for k, v in list(D.items()):
        if v > 1:
            dup.add(k)

    judge = [False] * (A[-1] + 1)
    res = 0
    for a in A:
        if judge[a]:
            continue
        else:
            if a not in dup:
                res += 1
            for i in range(a, A[-1] + 1, a):
                judge[i] = True

    print(res)


if __name__ == '__main__':
    resolve()
# Original solution
import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(eval(input()))
    A = sorted(list(map(int, input().split())))
    D = Counter(A)

    dup = set()
    for k, v in list(D.items()):
        if v > 1:
            dup.add(k)

    judge = [False] * (A[-1] + 1)
    res = 0
    for a in A:
        if judge[a]:
            continue
        else:
            if a not in dup:
                res += 1
            for i in range(a, A[-1] + 1, a):
                judge[i] = True

    print(res)


if __name__ == '__main__':
    resolve()


# Optimized solution
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(eval(input()))
    A = list(map(int, input().split()))

    num = [True] * (max(A) + 1)
    appear = set()
    for a in A:
        if a not in appear:
            appear.add(a)
        else:
            num[a] = False

    for a in A:
        for i in range(a * 2, len(num), a):
            num[i] = False

    res = 0
    for a in A:
        if num[a]:
            res += 1
    print(res)


if __name__ == '__main__':
    resolve()
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
c = [0]*1000001

for i in range(n):
  c[a[i]] -= 1
  for j in range(a[i],1000001,a[i]):
    c[j] += 2

ans=c.count(1)
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
kmax = sorted(a)[-1]
c = [0]*(kmax+1)

for i in range(n):
  c[a[i]] -= 1
  for j in range(a[i],(kmax+1),a[i]):
    c[j] += 2

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


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


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


n = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort()
Max = max(A)
cnt_dict = collections.Counter(A)
#Dict[i]はi未満の約数がAに存在しなければTrue
Dict = {a:True for a in A}
for a in A:
    times = 2
    while a*times<=Max:
        Dict[a*times]=False
        times +=1
ans = 0
for a in A:
    if cnt_dict[a]==1 and Dict[a]:
        ans +=1
print(ans)
# Original solution
N = int(eval(input()))
*A, = list(map(int, input().split()))
A = sorted(A)
cnt = [0] * (10**6 + 1)
for a in A: cnt[a] += 1
checked = [True] * N
ans = 0
for i, a in enumerate(A):
    if not checked[i]: continue
    flag = True
    for j in range(i+1, N):
        if A[j] % a == 0:
            checked[j] = False
            if A[j] == a: flag = False
    if flag: ans += 1 
print(ans)

# Optimized solution
from collections import Counter

N = int(eval(input()))
*A, = list(map(int, input().split()))
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)
# Original solution
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
import pprint



sys.setrecursionlimit(2147483647)
INF = 100
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n = I()
A = sorted(LI())
ans = 0
cnt = Counter(A)
B = [0] * (10 ** 6 + 1)
for a in A:
    if B[a] == 0 and cnt[a] == 1:
        ans += 1
    for i in range(a * 2, 10 ** 6 + 1, a):
        B[i] = 1


print(ans)





# Optimized solution
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
import pprint



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n = I()
A = sorted(LI())
ans = 0
cnt = Counter(A)
m = max(A) + 1
B = [0] * (10 ** 6 + 1)
for a in A:
    if B[a] == 0 and cnt[a] == 1:
        ans += 1
    for i in range(a * 2, m, a):
        B[i] = 1


print(ans)
# Original solution
import bisect
import copy
N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort()
table = [True for i in range(N)]
cands = [i for i in range(N)]
for i in range(N):
    if table[i]:
        idx = bisect.bisect_left(cands, i)
        del cands[idx]
        if i < N-1 and A[i] == A[i+1]:
            table[i] = False
        new_cands = copy.deepcopy(cands)
        for j in cands:
            if A[j] % A[i] == 0:
                table[j] = False
                idx = bisect.bisect_left(new_cands, j)
                del new_cands[idx]
        cands = copy.deepcopy(new_cands)
print((table.count(True)))


# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort()
a_max = max(A)
table = [True for i in range(a_max+1)]
for a in A:
    i = 2
    k = a * 2
    while k <= a_max:
        table[k] = False
        k += a
count = 0
for i, a in enumerate(A):
    if i < N - 1 and A[i] == A[i+1]:
        table[a] = False
    if table[a]:
        count += 1
print(count)
# Original solution
import sys
input = sys.stdin.readline

n = int(eval(input()))
L=list(map(int,input().split()))
count = 0
for i in range(n):
    val = L[i]
    for j in range(n):
        if j!=i:
            if L[i]%L[j]!=0:
                continue
            else:
                count+=1
                break
print((n-count))
            

    


# Optimized solution
import sys
input = sys.stdin.readline

n=int(eval(input()))
L=list(map(int,input().split()))
L.sort()
hb = L[-1]
dp = [-1 for i in range(hb+1)] 
for i in L:
    if dp[i]!=0:
        if dp[i]==1:
            dp[i]=0
            continue
        dp[i]=1
        for j in range(2*i,hb+1,i):
            dp[j]=0
ans=0
for i in L:
    if dp[i]==1:
        ans+=1
print(ans)
# Original solution
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : list(map(int, input().split()))
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(eval(input()))
	#b , c = tin()
	#s = input()
	al=lin()
	vm=10**6+1
	rr = [0]*(vm)
	for v in al:
		rr[v]+=1
	
	for v in list(set(al)):
		for i in range(2*v, vm, v):
			rr[i]=0
	ret = rr.count(1)
	print(ret)
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

# Optimized solution
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : list(map(int, input().split()))
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(eval(input()))
	#b , c = tin()
	#s = input()
	al=lin()
	vm=10**6+1
	rr = [0]*(vm)
	for v in al:
		rr[v]+=1
	ual=list(set(al))
	ual.sort()
	for v in ual:
		if rr[v]==0:
			continue
		for i in range(2*v, vm, v):
			rr[i]=0
	ret = rr.count(1)
	print(ret)
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
# Original solution
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))

N=II()
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)
for elem in A:
  for m in range(elem*2,10**6+1,elem):
    cnt[m]=1
ans=0
for i in unique:
  if cnt[i]==0:
    ans+=1
print(ans)  

# Optimized solution
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))

N=II()
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 i in unique:
  if cnt[i]==0:
    ans+=1
print(ans)
# Original solution
import itertools
n = int(eval(input()))
nlist = list(map(int, input().split()))

perm = list(itertools.permutations(nlist, 2))
ref = []
tmp = []
for num, j in enumerate(perm):
    tmp.append(j[0] % j[1])
    if (num + 1) % (len(nlist) - 1) == 0:
        ref.append(tmp)
        tmp = []
check = 0
for ind, i in enumerate(ref):
    if 0 in i:
        check += 1

print((len(nlist) - check))

# Optimized solution
n = int(eval(input()))
nlist = list(map(int, input().split()))

check = 0

for inum, i in enumerate(nlist[:]):
    for jnum, j in enumerate(nlist[:]):
        if inum != jnum:
            if i % j == 0:
                check += 1
                break


print((len(nlist) - check))
# Original solution
def main():
    numbers = int(eval(input()))
    array = [int(x) for x in input().split()]
    maximum = 1000001
    counter = [0] * maximum

    for x in array:
        if counter[x] != 0:
            counter[x] = 2
            continue
        else:
            for multiple in range(x, maximum, x):
                counter[multiple] += 1
    ans = 0
    for x in array:
        if counter[x] == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    eval(input())
    array = sorted(int(x) for x in input().split())
    maximum = 1000001
    counter = [0] * maximum

    for x in array:
        if counter[x] != 0:
            counter[x] = 2
            continue
        else:
            for multiple in range(x, maximum, x):
                counter[multiple] += 1
    ans = 0
    for x in array:
        if counter[x] == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
# Original solution
from collections import defaultdict


def main():
    eval(input())
    array = sorted(int(x) for x in input().split())
    maximum = 1000003

    counter = defaultdict(int)
    for x in array:
        counter[x] += 1
    maximum = array[-1] + 1
    candidates = [True] * maximum
    for key, value in list(counter.items()):
        if value > 1:  # duplicate
            candidates[key] = False
        for i in range(key * 2, maximum, key):
            candidates[i] = False

    ans = sum(candidates[x] for x in array)
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    eval(input())
    array = sorted(int(x) for x in input().split())
    maximum = array[-1] + 1
    counter = [0] * maximum

    for x in array:
        if counter[x] != 0:
            counter[x] = 2
            continue
        else:
            for multiple in range(x, maximum, x):
                counter[multiple] += 1
    ans = 0
    for x in array:
        if counter[x] == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

if N == 1:
    print((1))
    exit()
    
check_list = [0] * (10**6 + 1)

cnt = 0
for i in range(len(A)):
    tmp = A[i]
    while True:
        if tmp > 10**6:
            break
        check_list[tmp] += 1
        tmp += A[i]

for a in A:
    if check_list[a] == 1:
        cnt += 1
print(cnt)

# Optimized solution
N = int(eval(input()))
A = sorted(list(map(int, input().split())))

if N == 1:
    print((1))
    exit()
    
check_list = [0] * (10**6 + 1)

cnt = 0
for i in range(len(A)):
    tmp = A[i]
    while True:
        if tmp > A[-1]:
            break
        check_list[tmp] += 1
        tmp += A[i]

for a in A:
    if check_list[a] == 1:
        cnt += 1
print(cnt)
# Original solution
M=10**7
A=[0]*M
_,*l=list(map(int,open(0).read().split()))
for i in sorted(l):
    A[i]+=1
    if A[i]==1:
      for j in range(2*i,M,i):A[j]+=9
print((A.count(1)))

# Optimized solution
M=10**6+1
_,*l=list(map(int,open(0).read().split()))
a=[0]*M
for i in sorted(l):
  a[i]+=1
  if a[i]==1:
    for j in range(2*i,M,i): a[j]+=9
print((a.count(1)))
# Original solution
M=10**7
_,*l=list(map(int,open(0).read().split()))
a=[0]*M
for i in sorted(l):
  a[i]+=1
  if a[i]==1:
    for j in range(2*i,M,i):a[j]+=9
print((a.count(1)))

# Optimized solution
M=10**6+1
_,*l=list(map(int,open(0).read().split()))
a=[0]*M
for i in sorted(l):
  a[i]+=1
  if a[i]==1:
    for j in range(2*i,M,i):a[j]+=9
print((a.count(1)))
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))
nux = max(A)
B = set(A)
A.sort()
ans = 0
table = [True]*(nux+1)
for ii, s in enumerate(A):
    if table[s] == False:
        continue
    if ii == n-1:
        ans += 1
    elif A[ii+1] != s:
        ans += 1
    i = 1
    while i*s <= nux:
        table[i*s] = False
        i += 1

print(ans)


# Optimized solution
n = int(eval(input()))
A = sorted(map(int, input().split()))
nux = A[-1]+1
ans = 0
table = [True]*nux
for i, s in enumerate(A):
    if table[s] == False:
        continue
    if i == n-1:
        ans += 1
    elif A[i+1] != s:
        ans += 1
    b = 1
    while b*s < nux:
        table[b*s] = False
        b += 1
print(ans)
# Original solution
n=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
M=10**6+1
cnt=[0]*M
for i in A:
    if cnt[i]!=0:
        cnt[i]=2
        continue
    for j in range(i,M,i):
        cnt[j]+=1
ans=0
for i in A:
    if cnt[i]==1:
        ans+=1
print(ans)

# Optimized solution
from collections import Counter
max_=10**6+1
ans=0

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

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

for d in data:
    if b[d]:
        for j in range(d,max_,d):
            b[j]=False
        if c[d]==1:#複数存在考慮
            ans+=1
print(ans)
# Original solution
from collections import Counter
n=int(eval(input()))
*a,=list(map(int, input().split()))
sa=Counter(a)

if 1 in sa:
    if sa[1]>1:
        print((0))
    else:
        print((1))
    exit()

# def fct(x):
#     f1=[1]
#     f2=[]
#     for i in range(2,min(int(x**(1/2)+7),x)):
#         if x%i==0:
#             f1.append(i)
#             f2.append(x//i)
#     return (set(f1+f2))
ans=0
for ai in sa:
    if sa[ai]>1:
        continue
    
    ans+=1

    for i in range(2,min(int(ai**(1/2)+7),ai)):
        if ai%i==0:
            if i in sa or ai//i in sa:
                ans-=1
                break
print(ans)


# Optimized solution
from collections import Counter
n=int(eval(input()))
*a,=list(map(int, input().split()))
sa=Counter(a)

if 1 in sa:
    if sa[1]>1:
        print((0))
    else:
        print((1))
    exit()

# def fct(x):
#     f1=[1]
#     f2=[]
#     for i in range(2,min(int(x**(1/2)+7),x)):
#         if x%i==0:
#             f1.append(i)
#             f2.append(x//i)
#     return (set(f1+f2))
ans=0
for ai in sa:
    if sa[ai]>1:
        continue
    
    ans+=1
    if ai%2==0:
        for i in range(2,min(int(ai**(1/2)+7),ai)):
            if ai%i==0:
                if i in sa or ai//i in sa:
                    ans-=1
                    break
    else:
        for i in range(3,min(int(ai**(1/2)+7),ai),2):
            if ai%i==0:
                if i in sa or ai//i in sa:
                    ans-=1
                    break
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

dp = [1]*(max(a)+1)

for i in sorted(a):
  if 2 == dp[i]:
    continue
  if 3 == dp[i]:
    dp[i] = 2
    continue
  dp[i] = 3
  for j in range(2, max(a)//i + 1):
    dp[j * i] = 2

ans=0
for i in a:
  if dp[i] != 2:
    ans += 1
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
ma = max(a)
dp = [0]*(ma+1)

for i in sorted(a):
  if 1 <= dp[i]:
    dp[i] += 1
    continue

  for j in range(1, ma//i + 1):
    dp[j * i] += 1

ans=0
for i in a:
  if dp[i] == 1:
    ans += 1
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

AA = [0]*1000000

for i in range(N):
    ma = 1000000//A[i]
    for j in range(1,ma+1):
        AA[j*A[i]-1]+=1

ans = 0

for i in range(N):
    if AA[A[i]-1] == 1:
        ans += 1
        
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

mina = min(A)
maxa = max(A)
AA = [0]*(maxa-mina+1)

for i in range(N):
    maxj = maxa//A[i]
    for j in range(1,maxj+1):
        AA[j*A[i]-mina]+=1

ans = 0

for i in range(N):
    if AA[A[i]-mina] == 1:
        ans += 1
        
print(ans)
# Original solution
n = int(eval(input()))
A = [*list(map(int, input().split()))]
mx = max(A)
c = [0]*(1000000+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)


# Optimized solution
n = int(eval(input()))
A = [*list(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)
# Original solution
n = int(eval(input()))
A = [*list(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)


# Optimized solution
n = int(eval(input()))
A = [*list(map(int, input().split()))]
mx = max(A)
c = [0]*(mx+1)
for a in A:
    if c[a]: c[a] = 2; continue
    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)
# Original solution
def d170(n,a):
    count=0
    dp=[0 for i in range(max(a)+1)]
    for x in a:
        if dp[x]!=0:
                dp[x]=2
                
        else:
            for j in range(x,max(a)+1,x):
                     dp[j]+=1
    for x in a:
        if dp[x]==1:
            count+=1
    return count
    
n=int(eval(input()))
a=list(map(int, input().split()))    
print((d170(n,a)))

# Optimized solution
def d170(n,a):
    k=max(a)+1
    count=0
    dp=[0 for i in range(k)]
    for x in a:
        if dp[x]!=0:
                dp[x]=2
                
        else:
            for j in range(x,k,x):
                     dp[j]+=1
    for x in a:
        if dp[x]==1:
            count+=1
    return count
    
n=int(eval(input()))
a=list(map(int, input().split()))    
print((d170(n,a)))
# Original solution
n = int(eval(input()))
*A, = list(map(int, input().split()))

C = {a:0 for a in A}

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

maxA = max(A)

D = {a:0 for a in A}

for a in A:
    t = 2
    while a*t <= maxA:
        if a*t in A:
            D[a*t] = D[a*t]+1
        t = t+1

counter = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        counter = counter+1
        
print(counter)

# Optimized solution
n = int(eval(input()))
*A, = list(map(int, input().split()))

C = {a:0 for a in A}

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

maxA = max(A)

D = {a:0 for a in A}

for a in A:
    t = 2
    while a*t <= maxA:
        D[a*t] = 1
        t = t+1

counter = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        counter += 1
        
print(counter)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a)
cands = [0]*max(a)

ans = 0
for num in a:
    if cands[num-1] >= 2:
        continue
    for i in range(num, max(a)+1, num):
        cands[i-1] += 1
        
for num in a:
    if cands[num-1]==1:
        ans+=1
print(ans)

# Optimized solution
n = int(eval(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)