from collections import defaultdict





def main():

    eval(input())

    array = sorted(int(x) for x in input().split())

    maximum = 1000003



    counter = defaultdict(int)

    for x in array:

        counter[x] += 1

    maximum = array[-1] + 1

    candidates = [True] * maximum

    for key, value in list(counter.items()):

        if value > 1:  # duplicate

            candidates[key] = False

        for i in range(key * 2, maximum, key):

            candidates[i] = False



    ans = sum(candidates[x] for x in array)

    print(ans)





if __name__ == '__main__':

    main()

def main():

    eval(input())

    array = sorted(int(x) for x in input().split())

    maximum = array[-1] + 1

    counter = [0] * maximum



    for x in array:

        if counter[x] != 0:

            counter[x] = 2

            continue

        else:

            for multiple in range(x, maximum, x):

                counter[multiple] += 1

    ans = 0

    for x in array:

        if counter[x] == 1:

            ans += 1

    print(ans)





if __name__ == '__main__':

    main()

from collections import defaultdict


def main():
    eval(input())
    array = sorted(int(x) for x in input().split())
    maximum = 1000003
    counter = defaultdict(int)
    for x in array:
        counter[x] += 1
    maximum = array[-1] + 1
    candidates = [True] * maximum
    for key, value in list(counter.items()):
        if value > 1:  # duplicate
            candidates[key] = False
        for i in range(key * 2, maximum, key):
            candidates[i] = False
    ans = sum(candidates[x] for x in array)
    print(ans)


if __name__ == "__main__":
    main()

def main():
    eval(input())
    array = sorted(int(x) for x in input().split())
    maximum = array[-1] + 1
    counter = [0] * maximum
    for x in array:
        if counter[x] != 0:
            counter[x] = 2
            continue
        else:
            for multiple in range(x, maximum, x):
                counter[multiple] += 1
    ans = 0
    for x in array:
        if counter[x] == 1:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

-from collections import defaultdict - - -    maximum = 1000003 -    counter = defaultdict(int) +    maximum = array[-1] + 1 +    counter = [0] * maximum -        counter[x] += 1 -    maximum = array[-1] + 1 -    candidates = [True] * maximum -    for key, value in list(counter.items()): -        if value > 1:  # duplicate -            candidates[key] = False -        for i in range(key * 2, maximum, key): -            candidates[i] = False -    ans = sum(candidates[x] for x in array) +        if counter[x] != 0: +            counter[x] = 2 +            continue +        else: +            for multiple in range(x, maximum, x): +                counter[multiple] += 1 +    ans = 0 +    for x in array: +        if counter[x] == 1: +            ans += 1