#from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

#from fractions import gcd

#from itertools import combinations # (string,3) 3回

#from collections import deque

from collections import deque,defaultdict

#import bisect

#

#    d = m - k[i] - k[j]

#    if kk[bisect.bisect_right(kk,d) - 1] == d:

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#



import sys

sys.setrecursionlimit(10000000)

mod = 10**9 + 7

#mod = 9982443453

def readInts():

  return list(map(int,input().split()))

def I():

  return int(eval(input()))

n = I()

A = sorted(readInts())

dic = defaultdict(int)

cnt = 0

for i in A:

   dic[i] += 1

A = list(set(A))

# ------------

is_prime = [True] * (10**6+1)

#print('a')

for i in range(len(A)):

    #ll += 1

    #print(i)

    #print(A[i])

    if is_prime[A[i]] == True:

        for j in range(2*A[i], 10**6+1,A[i]):

            is_prime[j] = False # その素数の倍数のやつ



 # -----------

cnt = 0

if A[0] == 1:

    if dic[1] >= 2:

        print((0))

        exit()

    else:

        print((1))

        exit()

for a in A:

    if is_prime[a] and not dic[a] >= 2:

        #print(a)

        cnt += 1

print(cnt)

#from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

from fractions import gcd

from itertools import combinations,permutations # (string,3) 3回

#from collections import deque

from collections import deque,defaultdict

#import bisect

#

#    d = m - k[i] - k[j]

#    if kk[bisect.bisect_right(kk,d) - 1] == d:

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#



import sys

sys.setrecursionlimit(10000000)

mod = 10**9 + 7

#mod = 9982443453

def readInts():

  return list(map(int,input().split()))

def I():

  return int(eval(input()))

N = I()

A = readInts()

import collections

dic = collections.Counter(A)

A = set(A)

is_prime = [True] * (10**6+1)

for a in A:

    if is_prime[a]:

        for v in range(a*2,10**6+1,a):

            is_prime[v] = False

cnt = 0

for a in A:

    if is_prime[a]:

        cnt += 1

for k,v in list(dic.items()):

    if v >= 2 and is_prime[k]:

        cnt -= 1

print(cnt)

# from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from fractions import gcd
# from itertools import combinations # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict

# import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
import sys

sys.setrecursionlimit(10000000)
mod = 10**9 + 7
# mod = 9982443453
def readInts():
    return list(map(int, input().split()))


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


n = I()
A = sorted(readInts())
dic = defaultdict(int)
cnt = 0
for i in A:
    dic[i] += 1
A = list(set(A))
# ------------
is_prime = [True] * (10**6 + 1)
# print('a')
for i in range(len(A)):
    # ll += 1
    # print(i)
    # print(A[i])
    if is_prime[A[i]] == True:
        for j in range(2 * A[i], 10**6 + 1, A[i]):
            is_prime[j] = False  # その素数の倍数のやつ
# -----------
cnt = 0
if A[0] == 1:
    if dic[1] >= 2:
        print((0))
        exit()
    else:
        print((1))
        exit()
for a in A:
    if is_prime[a] and not dic[a] >= 2:
        # print(a)
        cnt += 1
print(cnt)

# from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations  # (string,3) 3回

# from collections import deque
from collections import deque, defaultdict

# import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
import sys

sys.setrecursionlimit(10000000)
mod = 10**9 + 7
# mod = 9982443453
def readInts():
    return list(map(int, input().split()))


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


N = I()
A = readInts()
import collections

dic = collections.Counter(A)
A = set(A)
is_prime = [True] * (10**6 + 1)
for a in A:
    if is_prime[a]:
        for v in range(a * 2, 10**6 + 1, a):
            is_prime[v] = False
cnt = 0
for a in A:
    if is_prime[a]:
        cnt += 1
for k, v in list(dic.items()):
    if v >= 2 and is_prime[k]:
        cnt -= 1
print(cnt)

-# from fractions import gcd -# from itertools import combinations # (string,3) 3回 +from fractions import gcd +from itertools import combinations, permutations  # (string,3) 3回 + -n = I() -A = sorted(readInts()) -dic = defaultdict(int) +N = I() +A = readInts() +import collections + +dic = collections.Counter(A) +A = set(A) +is_prime = [True] * (10**6 + 1) +for a in A: +    if is_prime[a]: +        for v in range(a * 2, 10**6 + 1, a): +            is_prime[v] = False -for i in A: -    dic[i] += 1 -A = list(set(A)) -is_prime = [True] * (10**6 + 1) -# print('a') -for i in range(len(A)): -    # ll += 1 -    # print(i) -    # print(A[i]) -    if is_prime[A[i]] == True: -        for j in range(2 * A[i], 10**6 + 1, A[i]): -            is_prime[j] = False  # その素数の倍数のやつ -cnt = 0 -if A[0] == 1: -    if dic[1] >= 2: -        print((0)) -        exit() -    else: -        print((1)) -        exit() -    if is_prime[a] and not dic[a] >= 2: -        # print(a) +    if is_prime[a]: +for k, v in list(dic.items()): +    if v >= 2 and is_prime[k]: +        cnt -= 1