import sys

def main():

    input = sys.stdin.readline

    N = int(eval(input()))

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

    w = [0] * (10 ** 6 + 1)

    for a in A:

        w[a] += 1

    f = [False] * (10 ** 6 + 1)

    for a in A:

        if f[a]:

            w[a] = 0

            continue

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

            w[b] = 0

        f[a] = True

    print((sum(w)))



if __name__ == '__main__':

    main()

# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)

import sys

def main(N, A):

    C = [0] * (10**6 + 1)

    for a in A:

        if C[a] == 1:

            C[a] = -1

            continue

        if C[a] == -1:

            continue

        C[a] = 1

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

            C[b] = -1

    ans = 0

    for a in A:

        if C[a] == 1:

            ans += 1

    print(ans)



if __name__ == '__main__':

    input = sys.stdin.readline

    N = int(eval(input()))

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

    main(N, A)

import sys


def main():
    input = sys.stdin.readline
    N = int(eval(input()))
    (*A,) = list(map(int, input().split()))
    w = [0] * (10**6 + 1)
    for a in A:
        w[a] += 1
    f = [False] * (10**6 + 1)
    for a in A:
        if f[a]:
            w[a] = 0
            continue
        for b in range(a * 2, 10**6 + 1, a):
            w[b] = 0
        f[a] = True
    print((sum(w)))


if __name__ == "__main__":
    main()

# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys


def main(N, A):
    C = [0] * (10**6 + 1)
    for a in A:
        if C[a] == 1:
            C[a] = -1
            continue
        if C[a] == -1:
            continue
        C[a] = 1
        for b in range(a + a, 10**6 + 1, a):
            C[b] = -1
    ans = 0
    for a in A:
        if C[a] == 1:
            ans += 1
    print(ans)


if __name__ == "__main__":
    input = sys.stdin.readline
    N = int(eval(input()))
    (*A,) = list(map(int, input().split()))
    main(N, A)

+# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) -def main(): +def main(N, A): +    C = [0] * (10**6 + 1) +    for a in A: +        if C[a] == 1: +            C[a] = -1 +            continue +        if C[a] == -1: +            continue +        C[a] = 1 +        for b in range(a + a, 10**6 + 1, a): +            C[b] = -1 +    ans = 0 +    for a in A: +        if C[a] == 1: +            ans += 1 +    print(ans) + + +if __name__ == "__main__": -    w = [0] * (10**6 + 1) -    for a in A: -        w[a] += 1 -    f = [False] * (10**6 + 1) -    for a in A: -        if f[a]: -            w[a] = 0 -            continue -        for b in range(a * 2, 10**6 + 1, a): -            w[b] = 0 -        f[a] = True -    print((sum(w))) - - -if __name__ == "__main__": -    main() +    main(N, A)