#!/usr/bin/env python3

import sys

import math

sys.setrecursionlimit(10**8)





def eratosthenes_sieve(n):

    table = [0] * (n + 1)

    prime_list = []



    for i in range(2, n + 1):

        if table[i] == 0:

            prime_list.append(i)

            for j in range(i + i, n + 1, i):

                table[j] = 1



    return prime_list





def main():

    N = int(eval(input()))

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



    ans = 0

    m = max(A)

    zeta = [0]*(m+1)

    for a in A:

        zeta[a] += 1



    # 素数の列挙

    primes = eratosthenes_sieve(m)

    # ゼータ変換

    for p in primes:

        for i in range(1, m//p+1):

            zeta[p*i] += zeta[i]



    for a in A:

        if zeta[a] == 1:

            ans += 1

    print(ans)



    # print(zeta)

    # for a in A:

    # print(a, zeta[a])



    return





if __name__ == '__main__':

    main()

#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**8)

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() for _ in range(n)]





INF = float("inf")

MOD = 10**9 + 7





def main():

    N = INT()

    A = LIST()

    A.sort()

    M = A[-1] + 1

    table = [0] * (M)



    for i in A:

        if table[i] == 0:

            table[i] = -1

            for j in range(i + i, M, i):

                table[j] = 1

        elif table[i] == -1:

            # 重複しているということ

            table[i] = -2

    # print(table)

    cnt = 0

    for i in range(N):

        if table[A[i]] == -1:

            cnt += 1

    print(cnt)



    return





if __name__ == '__main__':

    main()

#!/usr/bin/env python3
import sys
import math

sys.setrecursionlimit(10**8)


def eratosthenes_sieve(n):
    table = [0] * (n + 1)
    prime_list = []
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(i + i, n + 1, i):
                table[j] = 1
    return prime_list


def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    ans = 0
    m = max(A)
    zeta = [0] * (m + 1)
    for a in A:
        zeta[a] += 1
    # 素数の列挙
    primes = eratosthenes_sieve(m)
    # ゼータ変換
    for p in primes:
        for i in range(1, m // p + 1):
            zeta[p * i] += zeta[i]
    for a in A:
        if zeta[a] == 1:
            ans += 1
    print(ans)
    # print(zeta)
    # for a in A:
    # print(a, zeta[a])
    return


if __name__ == "__main__":
    main()

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10**8)


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() for _ in range(n)]


INF = float("inf")
MOD = 10**9 + 7


def main():
    N = INT()
    A = LIST()
    A.sort()
    M = A[-1] + 1
    table = [0] * (M)
    for i in A:
        if table[i] == 0:
            table[i] = -1
            for j in range(i + i, M, i):
                table[j] = 1
        elif table[i] == -1:
            # 重複しているということ
            table[i] = -2
    # print(table)
    cnt = 0
    for i in range(N):
        if table[A[i]] == -1:
            cnt += 1
    print(cnt)
    return


if __name__ == "__main__":
    main()

-import math -def eratosthenes_sieve(n): -    table = [0] * (n + 1) -    prime_list = [] -    for i in range(2, n + 1): -        if table[i] == 0: -            prime_list.append(i) -            for j in range(i + i, n + 1, i): -                table[j] = 1 -    return prime_list +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() for _ in range(n)] + + +INF = float("inf") +MOD = 10**9 + 7 -    N = int(eval(input())) -    A = list(map(int, input().split())) -    ans = 0 -    m = max(A) -    zeta = [0] * (m + 1) -    for a in A: -        zeta[a] += 1 -    # 素数の列挙 -    primes = eratosthenes_sieve(m) -    # ゼータ変換 -    for p in primes: -        for i in range(1, m // p + 1): -            zeta[p * i] += zeta[i] -    for a in A: -        if zeta[a] == 1: -            ans += 1 -    print(ans) -    # print(zeta) -    # for a in A: -    # print(a, zeta[a]) +    N = INT() +    A = LIST() +    A.sort() +    M = A[-1] + 1 +    table = [0] * (M) +    for i in A: +        if table[i] == 0: +            table[i] = -1 +            for j in range(i + i, M, i): +                table[j] = 1 +        elif table[i] == -1: +            # 重複しているということ +            table[i] = -2 +    # print(table) +    cnt = 0 +    for i in range(N): +        if table[A[i]] == -1: +            cnt += 1 +    print(cnt)