CodeEff/ECCO huggingface dataset:
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return eval(input())

def yakusu(n):
    yakusu = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            yakusu.append(i)
            if n // i != i:
                yakusu.append(n//i)
    return yakusu
     
baisu = [False] * (10**6 + 1)
def main():
    N = I()
    A = LI()

    ok = 0
    for a in A:
        if baisu[a]:
            continue
        if not baisu[a]:
            num = a + a
            while num < 10**6+1:
                baisu[num] = True
                num += a
    s = collections.Counter(A)
    for a in A:
        if not baisu[a]:
            if s[a] > 1:
                continue
            ok += 1
    print(ok)
main()



# Optimized solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return eval(input())

def yakusu(n):
    yakusu = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            yakusu.append(i)
            if n // i != i:
                yakusu.append(n//i)
    return yakusu
     
baisu = [False] * (10**6 + 1)
def main():
    N = I()
    A = LI()

    ok = 0
    for a in set(A):
        if baisu[a]:
            continue
        if not baisu[a]:
            num = a + a
            while num < 10**6+1:
                baisu[num] = True
                num += a
    s = collections.Counter(A)
    for a in A:
        if not baisu[a]:
            if s[a] > 1:
                continue
            ok += 1
    print(ok)
main()
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))

A.sort()
count = 0
for i in range(n - 1):
    if A[i] % A[i + 1] == 0:
        count += 1
        continue
    for j in range(i):
        if A[i] % A[j] == 0:
            count += 1
            break
i = n - 1
for j in range(i):
    if A[i] % A[j] == 0:
        count += 1
        break
print((n - count))


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

dp = [False] * (A[-1] + 1)
for a in A:
    dp[a] = True

for idx, a in enumerate(A):
    if A[idx] == A[idx - 1]:
        if idx == 0:
            None
        else:
            dp[a] = False
    for j in range(2, A[-1]//a + 1):
        dp[a * j] = False

count = 0
for d in dp:
    if d:
        count += 1
print(count)
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
dp = [True] * (10 ** 6 + 1)  # 自分以外約数ないならTrue
visited = [False] * (10 ** 6 + 1)
for a in A:
    if visited[a]:
        dp[a] = False
        continue
    visited[a] = True
    i = 2
    while a * i <= 10 ** 6:
        dp[a * i] = False
        i += 1
ans = 0
for a in A:
    ans += dp[a]
print(ans)

# Optimized solution
n = eval(input())
*A, = list(map(int, input().split()))
max_A = max(A)
count = {a:0 for a in A}
for a in A:
    count[a] += 1
is_OK = {a:True for a in A}
for a in A:
    i = 2
    if not is_OK[a]:
        continue
    while a * i < max_A + 1:
        is_OK[a * i] = False
        i += 1
ans = 0
for a in A:
    if count[a] == 1 and is_OK[a]:
        ans += 1
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()

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

ans = 0
for i in range(1, a[-1] + 1):
    if cnt[i] > 0:
        if cnt[i] == 1:
            ans += 1
        for j in range(2, a[-1] + 1):
            na = i * j
            if na <= a[-1]:
                cnt[na] = 0
            else:
                break

print(ans)


# Optimized solution
n = int(eval(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)
# Original solution
from collections import Counter

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


# Optimized solution
from collections import Counter

n = int(eval(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:
            ans += 1

print(ans)
# Original solution
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(eval(input()))
from collections import Counter
a = list(map(int, input().split()))
c = Counter(a)
s = set()
for k,v in list(c.items()):
    if v>=2:
        s.add(k)
        
a.sort()
ok = set()
p = set(list(range(1, 10**6+1)))
ck = list(c.keys())
ck.sort()
for num in ck:
    if num in p:
        ok.add(num)
    i = 2
    while num*i<=10**6:
        if num*i in p:
            p.remove(num*i)
        i += 1
tmp = ok
tmp = set(tmp) - s
print((len(tmp)))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
vals = [True]*(max(a)+1)
ans = 0
m = max(a)+1
for i in range(1, m):
    if i not in c:
        continue
    if c[i]>=2:
        vals[i] = False
    for j in range(2*i, m, i):
        vals[j] = False
ans = 0
for i in range(1, max(a)+1):
  if vals[i] and i in c:
    ans += 1

print(ans)
# Original solution
import math
from collections import defaultdict
def r():
    return int(eval(input()))
def rm():
    return list(map(int,input().split()))
def rl():
    return list(map(int,input().split()))

'''D'''
n=r()
a=rl()
b=[0]*(max(a)+1)
for i in a:
    if b[i]!=0:
        b[i]+=1
        continue
    else:
        b[i]+=1
    for j in range(2*i,max(a)+1,i):
        b[j]+=1
ans=0
for i in a:
    ans+=(1 if b[i]==1 else 0)
print(ans)

# Optimized solution
import math
from collections import defaultdict
def r():
    return int(eval(input()))
def rm():
    return list(map(int,input().split()))
def rl():
    return list(map(int,input().split()))

'''D'''
n=r()
a=rl()
ma=max(a)
b=[0]*(ma+1)
a.sort()
for i in a:
    if b[i]!=0:
        b[i]+=1
        continue
    else:
        b[i]+=1
    for j in range(2*i,ma+1,i):
        b[j]+=1
ans=0
for i in a:
    if b[i]==1:
        ans+=1
print(ans)
# Original solution
from math import ceil

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

m = 10**6+100
n_map = {}
v_a = []
nn_map = {}
for i in a:
    if i not in n_map:
        n_map[i] = 1
    else:
        n_map[i] += 1
    if i in nn_map:
        continue
    for j in range(2, ceil(m / i) + 1):
        nn_map[i * j] = True


res = 0
for k, v in list(n_map.items()):
    if v != 1:
        continue
    if k in nn_map:
        continue
    res += 1

print(res)

# Optimized solution
from math import ceil

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

m = 10 ** 6
n_map = {}
v_a = []
for i in a:
    if i not in n_map:
        n_map[i] = 1
    else:
        n_map[i] += 1
v_a = [(k,v) for k, v in list(n_map.items())]

v_a.sort(key=lambda x: x[0])
res = 0
nn_map = {}
for i, v in v_a:
    if i in nn_map:
        continue
    for j in range(1, ceil(m / i) + 1):
        nn_map[i * j] = True
    if v == 1:
        res += 1
print(res)
# Original solution
n=int(eval(input()))
a=sorted(list(map(int,input().split())))
c=[1]*n
for i in range(n-1):
  t=a[i]
  if c[i]:
    if t==a[i+1]:
      c[i]=0
    for j in range(i+1,n):
      if a[j]%t==0:
        c[j]=0
print((sum(c)))

# Optimized solution
n=int(eval(input()))
a=sorted(list(map(int,input().split())))
m=max(a)
b=[1]*m
c=[0]*m
for i in a:
  c[i-1]+=1
  if b[i-1]:
    for j in range(i*2-1,m,i):
      b[j]=0
x=0
for i in range(m):
  if b[i] and c[i]==1:
    x+=1
print(x)
# Original solution
d=[i:=0]*8**7
for j in[*open(0)][1].split():d[int(j)]+=1
while i<1e6:
 i+=1;j=i
 while j<1e6:j+=i;d[j]*=d[i]<1
print((d.count(1)))

# Optimized solution
d=[0]*8**7
for j in[*open(0)][1].split():d[int(j)]+=1
i=0
while i<1e6:
 i+=1;j=i
 while j<1e6:j+=i;d[j]*=d[i]<1
print((d.count(1)))
# Original solution
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
c = Counter(a)
a = sorted(a)

isprime = {a[i]:True for i in range(n)}

for i in range(n):
    if a[i] > a[-1]//2: break 
    if not isprime[a[i]]: continue
    for j in range(2, a[-1]//a[i]+1):
        if a[i]*j in a:
            isprime[a[i]*j] = False

diff = len([i for i in range(len(c)) if list(c.values())[i] != 1 and isprime[list(c.keys())[i]]])
print((list(isprime.values()).count(True)-diff))


# Optimized solution
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
c = Counter(a)
a = sorted(a)
M = max(a)
isprime = [0]*(M+1)

for i in range(n):
    if isprime[a[i]]==0:
        isprime[a[i]] = 1
        tmp = 2
        while a[i]*tmp < M+1:
            isprime[a[i]*tmp] = 2
            tmp += 1
    elif isprime[a[i]] == 1:
        isprime[a[i]] = 2

ans = 0
for ele in a:
    if isprime[ele] != 2:
        ans += 1
print(ans)
# Original solution
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
c = Counter(a)
a = sorted(a)

isprime = {a[i]:True for i in range(n)}

for i in range(n): 
    if not isprime[a[i]]: continue
    j = 2
    while a[i]*j < a[-1]+1:
        if a[i]*j in a:
            isprime[a[i]*j] = False
        j += 1

ensem = list(c.values())
key = list(c.keys())
diff = len([i for i in range(len(c)) if ensem[i] != 1 and isprime[key[i]]])
print((list(isprime.values()).count(True)-diff))


# Optimized solution
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
c = Counter(a)
a = sorted(a)

isprime = {a[i]:True for i in range(n)}

for i in range(n): 
    if not isprime[a[i]]: continue
    j = 2
    while a[i]*j < a[-1]+1:
        if isprime.get(a[i]*j) == True:
            isprime[a[i]*j] = False
        j += 1

ensem = list(c.values())
key = list(c.keys())
diff = len([i for i in range(len(c)) if ensem[i] != 1 and isprime[key[i]]])
print((list(isprime.values()).count(True)-diff))
# Original solution
def main():
    n = int(eval(input()))
    a = sorted(list(map(int,input().split())))
    for i in range(n-1):
        if a[i]!=0:
            flg = 0
            for j in range(i+1,n):
                if a[i]==a[j]:
                    flg=1
                    a[j] = 0
                elif a[j]%a[i]==0:
                    a[j] = 0
            if flg==1:
                a[i] = 0
    ans = 0
    for i in range(n):
        if a[i]!=0:
            ans+=1
    print(ans)

if __name__ == "__main__":
    main()


# Optimized solution
def main():
    n = int(eval(input()))
    a = sorted(list(map(int,input().split())))
    dp = [0 for i in range(a[-1]+1)]
    lbl = []
    for i in range(n):
        if dp[a[i]]==2:
            lbl.append(a[i])
            continue
        if dp[a[i]]==1:
            continue
        else:
            for j in range(1,a[-1]//a[i]+1):
                dp[a[i]*j] = 1
            dp[a[i]] = 2
    for i in range(len(lbl)):
        dp[lbl[i]] = 0
    ans = 0
    for i in range(len(dp)):
        if dp[i] == 2:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()
# Original solution
def main():
    n = int(eval(input()))
    a = sorted(list(map(int,input().split())))
    dp = [0 for i in range(a[-1]+1)]
    lbl = []
    for i in range(n):
        if dp[a[i]]==2:
            lbl.append(a[i])
            continue
        if dp[a[i]]==1:
            continue
        else:
            for j in range(1,a[-1]//a[i]+1):
                dp[a[i]*j] = 1
            dp[a[i]] = 2
    for i in range(len(lbl)):
        dp[lbl[i]] = 0
    ans = 0
    for i in range(len(dp)):
        if dp[i] == 2:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()


# Optimized solution
def main():
    n = int(eval(input()))
    a = sorted(map(int,input().split()))
    fld = [-1 for i in range(a[-1]+1)]
    flg = []
    for i in range(n):
        if fld[a[i]]==-1:
            fld[a[i]]=1
            for j in range(2,a[-1]//a[i]+1):
                fld[a[i]*j] = 0
        elif fld[a[i]]==1:
            flg.append(a[i])
    for i in range(len(flg)):
        fld[flg[i]] = 0
    ans = 0
    for i in range(len(fld)):
        if fld[i] == 1:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()
# Original solution
n = int(eval(input()))
a_list = list(map(int,input().split()))
a_list = sorted(a_list)
flag  = [0]*n

ans = 0
for i in range(len(a_list)):
    if flag[i] == 1:
        continue
    if i == n-1:
        ans += 1
        break
    if 0 not in flag:
        break
    flag[i] = 1
    
    if a_list[i] != a_list[i+1]:
        ans += 1
    for j in range(i+1,len(a_list)):
        if a_list[j]%a_list[i] == 0:
            flag[j] = 1

print(ans)

# Optimized solution
n = int(eval(input()))
a_list = list(map(int,input().split()))
a_list = sorted(a_list)
flag  = [0]*n


ans = 0
m = max(a_list)
b_list = [0]*(m+1)
for i in a_list:
    b_list[i] += 1
for i in a_list:
    if b_list[i] == 1:
        ans += 1

    for j in range(i , m+1 ,i):
        b_list[j]+= 1
print(ans)
# Original solution
from collections import Counter

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

MAX = 10 ** 6
is_divisible = [True] * (MAX + 1)
is_divisible[0] = False
for i in A:
    if not is_divisible[i]:
        continue
    for j in range(i * 2, MAX + 1, i):
        is_divisible[j] = False

for k, v in list(Counter(A).items()):
    if v > 1:
        is_divisible[k] = False

st = {i for i in range(MAX + 1) if is_divisible[i]}
print((len(st & set(A))))


# Optimized solution
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
S = sorted(list(set(A)))

MAX = 10 ** 6
is_divisible = [True] * (MAX + 1)
is_divisible[0] = False
for i in S:
    if not is_divisible[i]:
        continue
    for j in range(i * 2, MAX + 1, i):
        is_divisible[j] = False

for k, v in list(Counter(A).items()):
    if v > 1:
        is_divisible[k] = False

ans = len([a for a in A if is_divisible[a]])
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

cand = set(a)

exist = set()
dup = set()
for item in a:
    if item in exist:
        dup.add(item)
    else:
        exist.add(item)

dame_set = set()

a.sort()
ret = 0

for val in a:
    if val in dup:
        i = 1
        cnt = 10 ** 6 // val
        while i <= cnt:
            tmp = i * val
            if tmp in cand:
                dame_set.add(tmp)
            i += 1
    else:
        if val in dame_set:
            continue
        else:
            ret += 1
            i = 1
            cnt = 10 ** 6 // val
            while i <= cnt:
                tmp = i * val
                if tmp in cand:
                    dame_set.add(tmp)
                i += 1

print(ret)


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

cand = set(a)

exist = set()
dup = set()
for item in a:
    if item in exist:
        dup.add(item)
    else:
        exist.add(item)

dame_set = set()

a.sort()
ret = 0

for val in a:
    if val in dup:
        if val in dame_set:
            continue
        else:
            i = 1
            cnt = 10 ** 6 // val
            while i <= cnt:
                tmp = i * val
                if tmp in cand:
                    dame_set.add(tmp)
                i += 1
    else:
        if val in dame_set:
            continue
        else:
            ret += 1
            i = 1
            cnt = 10 ** 6 // val
            while i <= cnt:
                tmp = i * val
                if tmp in cand:
                    dame_set.add(tmp)
                i += 1

print(ret)
# Original solution
import math , sys

N = int( eval(input()) )
A = list( map( int, input().split() ))
A.sort()
Cs = [0 for _ in range(10**6+1)]
#print(A)
i=0
#M = min(max(A),10**6+1)
for i in range(N):
    e = A[i]
    if Cs[e]==1:
        Cs[e]=2
    elif Cs[e]==0:
        Cs[e]=1

for i in range(len(Cs)):
    Cs[i] = Cs[i]%2

for e in A:
    i = 2
    while e*i <10**6+1:
        Cs[e*i] = 0
        i+=1
ans = sum(Cs)
print(ans)


# Optimized solution
import math , sys

N = int( eval(input()) )
A = list( map( int, input().split() ))
A.sort()
Cs = [0 for _ in range(10**6+1)]
M = A[-1]
#print(A)
i=0
M = max(A)
for i in range(N):
    e = A[i]
    if Cs[e]==1:
        Cs[e]=2
    elif Cs[e]==0:
        Cs[e]=1

for i in range(len(Cs)):
    Cs[i] = Cs[i]%2

for e in A:
    i = 2
    while e*i <= M:
        Cs[e*i] = 0
        i+=1
ans = sum(Cs)
print(ans)
# Original solution
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(eval(input()))
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print((k.join(list(map(str, lst)))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    N = II()
    A = LI()

    cost = {}
    for a in A:
        if cost.get(a, -1) == -1:
            cost[a] = 1
        else:
            cost[a] = 0

    A = sorted(A)

    memo = [0] * (A[-1] + 1)
    ans = 0
    for a in A:
        for i in range(1, int(a ** 0.5) + 1):
            if a % i: continue
            if memo[i] or memo[a//i]:
                break
        else:
            ans += cost[a]

        memo[a] = 1
    print(ans)


if __name__ == '__main__':
    solve()


# Optimized solution
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(eval(input()))
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print((k.join(list(map(str, lst)))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

def solve():
    N = II()
    A = LI()

    mx = max(A)

    memo = [0] * (mx + 1)
    for a in A:
        for i in range(a, mx+1, a):
            memo[i] += 1
    # print(memo)

    ans = 0
    for a in A:
        if memo[a] == 1:
            ans += 1
    print(ans)

if __name__ == '__main__':
    solve()
# Original solution
n = int(eval(input()))
a = sorted(map(int, input().split()))
l = [0]*(10**6+1)

for i in a:
  if l[i] == 0:
    l[i] = 1
    for j in range(i*2, max(a)+1, i):
      l[j] = -1
  else:
    l[i] = -1
print((l.count(1)))

# Optimized solution
n = int(eval(input()))
a = sorted(map(int, input().split()))
l = [0]*(10**6+1)
M = max(a)

for i in a:
  if l[i] == 0:
    l[i] = 1
    for j in range(i*2, M+1, i):
      l[j] = -1
  else:
    l[i] = -1
print((l.count(1)))
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
x=0

for i in range(N):
  for j in range(N):
    if i==j:
      pass
    elif A[i]%A[j]==0:
      break
  else:
    x+=1

print(x)

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
AM=max(A)+1
B=[0]*AM
x=0
for i in A:
  for j in range(i,AM,i):
    B[j]+=1
for i in A:
  if B[i]==1:
    x+=1
print(x)
# Original solution
N=eval(input())
A=sorted(map(int,input().split()))
M=A[-1]+1
B=[True]*M
c=0
x=0
for i in A:
  if B[i]==True:
    if i!=c:
      for j in range(i*2,M,i):
        B[j]=False
      x+=1
      c=i
    else:
      B[i]=False
      x-=1
print(x)

# Optimized solution
def main():
  N=eval(input())
  A=sorted(map(int,input().split()))
  M=A[-1]+1
  B=[True]*M
  c=0
  x=0
  for i in A:
    if B[i]:
      if i!=c:
        for j in range(i*2,M,i):
          B[j]=False
        x+=1
        c=i
      else:
        B[i]=False
        x-=1
  print(x)
main()