from collections import Counter

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines





def main():

    N, *A = list(map(int, read().split()))



    t = Counter(A)

    A.sort()

    table = [True] * (A[-1] + 1)

    n = len(table)



    seen = set()

    for a in A:

        if a in seen:

            continue

        for i in range(2*a, n, a):

            table[i] = False

        seen.add(a)



    ans = 0

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

        if v > 1:

            continue

        else:

            if table[k]:

                ans += 1



    print(ans)





if __name__ == "__main__":

    main()

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



def main():

    N,*A = list(map(int, read().split()))



    A.sort()

    table = [0] * (A[-1] + 1)

    n = len(table)



    for a in A:

        if table[a] > 1:

            continue



        if table[a] == 0:

            for i in range(2*a, n, a):

                table[i] = 2

        

        table[a] += 1



    ans = 0

    for a in A:

        if table[a] == 1:

            ans += 1



    print(ans)





if __name__ == "__main__":

    main()

from collections import Counter
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N, *A = list(map(int, read().split()))
    t = Counter(A)
    A.sort()
    table = [True] * (A[-1] + 1)
    n = len(table)
    seen = set()
    for a in A:
        if a in seen:
            continue
        for i in range(2 * a, n, a):
            table[i] = False
        seen.add(a)
    ans = 0
    for k, v in list(t.items()):
        if v > 1:
            continue
        else:
            if table[k]:
                ans += 1
    print(ans)


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N, *A = list(map(int, read().split()))
    A.sort()
    table = [0] * (A[-1] + 1)
    n = len(table)
    for a in A:
        if table[a] > 1:
            continue
        if table[a] == 0:
            for i in range(2 * a, n, a):
                table[i] = 2
        table[a] += 1
    ans = 0
    for a in A:
        if table[a] == 1:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

-from collections import Counter -    t = Counter(A) -    table = [True] * (A[-1] + 1) +    table = [0] * (A[-1] + 1) -    seen = set() -        if a in seen: +        if table[a] > 1: -        for i in range(2 * a, n, a): -            table[i] = False -        seen.add(a) +        if table[a] == 0: +            for i in range(2 * a, n, a): +                table[i] = 2 +        table[a] += 1 -    for k, v in list(t.items()): -        if v > 1: -            continue -        else: -            if table[k]: -                ans += 1 +    for a in A: +        if table[a] == 1: +            ans += 1