def main():

    import sys

    read = sys.stdin.buffer.read

    readline = sys.stdin.buffer.readline

    readlines = sys.stdin.buffer.readlines

    sys.setrecursionlimit(10 ** 7)



    from collections import Counter



    n = int(readline())

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

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

    ans = 0

    for k, v in sorted(Counter(a).items()):

        if v == 1 and memo[k]:

            ans += 1

        memo[k] = False

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

            if 10 ** 6 + 1 <= i * k:

                break

            memo[i * k] = False

    print(ans)





if __name__ == '__main__':

    main()

def main():

    import sys

    read = sys.stdin.buffer.read

    readline = sys.stdin.buffer.readline

    readlines = sys.stdin.buffer.readlines

    sys.setrecursionlimit(10 ** 7)



    n = int(readline())

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

    a.sort()

    limit = a[-1]

    dp = [0] * (limit + 1)

    for aa in a:

        dp[aa] += 1

        if dp[aa] == 1:

            for i in range(aa * 2, limit + 1, aa):

                dp[i] += 1

    print((sum((1 for aa in a if dp[aa] == 1))))





if __name__ == '__main__':

    main()

def main():
    import sys

    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10**7)
    from collections import Counter

    n = int(readline())
    a = list(map(int, readline().split()))
    memo = [True] * (10**6 + 1)
    ans = 0
    for k, v in sorted(Counter(a).items()):
        if v == 1 and memo[k]:
            ans += 1
        memo[k] = False
        for i in range(1, 10**6 + 1):
            if 10**6 + 1 <= i * k:
                break
            memo[i * k] = False
    print(ans)


if __name__ == "__main__":
    main()

def main():
    import sys

    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10**7)
    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort()
    limit = a[-1]
    dp = [0] * (limit + 1)
    for aa in a:
        dp[aa] += 1
        if dp[aa] == 1:
            for i in range(aa * 2, limit + 1, aa):
                dp[i] += 1
    print((sum((1 for aa in a if dp[aa] == 1))))


if __name__ == "__main__":
    main()

-    from collections import Counter - -    memo = [True] * (10**6 + 1) -    ans = 0 -    for k, v in sorted(Counter(a).items()): -        if v == 1 and memo[k]: -            ans += 1 -        memo[k] = False -        for i in range(1, 10**6 + 1): -            if 10**6 + 1 <= i * k: -                break -            memo[i * k] = False -    print(ans) +    a.sort() +    limit = a[-1] +    dp = [0] * (limit + 1) +    for aa in a: +        dp[aa] += 1 +        if dp[aa] == 1: +            for i in range(aa * 2, limit + 1, aa): +                dp[i] += 1 +    print((sum((1 for aa in a if dp[aa] == 1))))