import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd

from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from heapq import heappush, heappop

from functools import reduce

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

def ZIP(n): return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7



N = INT()

A = LIST()

lim = max(A)+1

cnt = [0]*lim

is_prime = [1]*lim



for x in A:

	cnt[x] += 1



for i in range(2, lim):

	if not is_prime[i]: continue

	for j in range(2*i, lim, i):

		is_prime[j] = 0

	for j in range(1, -(-lim//i)):

		cnt[i*j] += cnt[j]



ans = 0



for a in A:

    if cnt[a] == 1:

        ans += 1

print(ans)

import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd

from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from heapq import heappush, heappop

from functools import reduce

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

def ZIP(n): return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7



N = INT()

A = LIST()



ans = 0

lim = max(A)+1

ok = [True]*lim

checked = [False]*lim



for a in sorted(A):

    if (not checked[a]) and ok[a]:

        checked[a] = True

        for j in range(a*2, lim, a):

            ok[j] = False



cnt = Counter(A)

for a in A:

    if cnt[a] == 1 and ok[a]:

        ans += 1

print(ans)

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
    accumulate,
    permutations,
    combinations,
    product,
    groupby,
    combinations_with_replacement,
)
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce


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


def ZIP(n):
    return list(zip(*(MAP() for _ in range(n))))


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
N = INT()
A = LIST()
lim = max(A) + 1
cnt = [0] * lim
is_prime = [1] * lim
for x in A:
    cnt[x] += 1
for i in range(2, lim):
    if not is_prime[i]:
        continue
    for j in range(2 * i, lim, i):
        is_prime[j] = 0
    for j in range(1, -(-lim // i)):
        cnt[i * j] += cnt[j]
ans = 0
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
    accumulate,
    permutations,
    combinations,
    product,
    groupby,
    combinations_with_replacement,
)
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce


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


def ZIP(n):
    return list(zip(*(MAP() for _ in range(n))))


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
N = INT()
A = LIST()
ans = 0
lim = max(A) + 1
ok = [True] * lim
checked = [False] * lim
for a in sorted(A):
    if (not checked[a]) and ok[a]:
        checked[a] = True
        for j in range(a * 2, lim, a):
            ok[j] = False
cnt = Counter(A)
for a in A:
    if cnt[a] == 1 and ok[a]:
        ans += 1
print(ans)

+ans = 0 -cnt = [0] * lim -is_prime = [1] * lim -for x in A: -    cnt[x] += 1 -for i in range(2, lim): -    if not is_prime[i]: -        continue -    for j in range(2 * i, lim, i): -        is_prime[j] = 0 -    for j in range(1, -(-lim // i)): -        cnt[i * j] += cnt[j] -ans = 0 +ok = [True] * lim +checked = [False] * lim +for a in sorted(A): +    if (not checked[a]) and ok[a]: +        checked[a] = True +        for j in range(a * 2, lim, a): +            ok[j] = False +cnt = Counter(A) -    if cnt[a] == 1: +    if cnt[a] == 1 and ok[a]: