from time import time





def fact(x):

    i = 1

    while i * i <= x:

        if x % i == 0:

            yield i

            yield x // i

        i += 1





def main():

    n = int(eval(input()))

    a = tuple(map(int, input().split()))

    now = time()



    c = [0] * (max(a) + 1)



    for e in a:

        c[e] += 1



    ans = n

    for e in a:

        c[e] -= 1

        for fct in fact(e):

            if c[fct]:

                ans -= 1

                break



        if time() - now >= 1.8:

            print(n)

            exit()



        c[e] += 1



    print(ans)





if __name__ == "__main__":

    main()

from collections import Counter

import numpy as np



n = int(eval(input()))

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

MAX = 10 ** 6



c = Counter(a)

arr = np.zeros(MAX + 1, np.int64)

st = set()

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

    if v != 1:

        st.add(k)

    arr[k] = 1



for i in range(MAX + 1):

    if arr[i]:

        arr[i*2::i] = 0



    if i in st:

        arr[i] = 0



print((arr.sum()))

from time import time


def fact(x):
    i = 1
    while i * i <= x:
        if x % i == 0:
            yield i
            yield x // i
        i += 1


def main():
    n = int(eval(input()))
    a = tuple(map(int, input().split()))
    now = time()
    c = [0] * (max(a) + 1)
    for e in a:
        c[e] += 1
    ans = n
    for e in a:
        c[e] -= 1
        for fct in fact(e):
            if c[fct]:
                ans -= 1
                break
        if time() - now >= 1.8:
            print(n)
            exit()
        c[e] += 1
    print(ans)


if __name__ == "__main__":
    main()

from collections import Counter
import numpy as np

n = int(eval(input()))
a = list(map(int, input().split()))
MAX = 10**6
c = Counter(a)
arr = np.zeros(MAX + 1, np.int64)
st = set()
for k, v in list(c.items()):
    if v != 1:
        st.add(k)
    arr[k] = 1
for i in range(MAX + 1):
    if arr[i]:
        arr[i * 2 :: i] = 0
    if i in st:
        arr[i] = 0
print((arr.sum()))

-from time import time +from collections import Counter +import numpy as np - -def fact(x): -    i = 1 -    while i * i <= x: -        if x % i == 0: -            yield i -            yield x // i -        i += 1 - - -def main(): -    n = int(eval(input())) -    a = tuple(map(int, input().split())) -    now = time() -    c = [0] * (max(a) + 1) -    for e in a: -        c[e] += 1 -    ans = n -    for e in a: -        c[e] -= 1 -        for fct in fact(e): -            if c[fct]: -                ans -= 1 -                break -        if time() - now >= 1.8: -            print(n) -            exit() -        c[e] += 1 -    print(ans) - - -if __name__ == "__main__": -    main() +n = int(eval(input())) +a = list(map(int, input().split())) +MAX = 10**6 +c = Counter(a) +arr = np.zeros(MAX + 1, np.int64) +st = set() +for k, v in list(c.items()): +    if v != 1: +        st.add(k) +    arr[k] = 1 +for i in range(MAX + 1): +    if arr[i]: +        arr[i * 2 :: i] = 0 +    if i in st: +        arr[i] = 0 +print((arr.sum()))