from sys import stdin

n = int(eval(input()))

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

a.sort()

amax = max(a)+1

e = [True]*amax

Alice = set()

Bob = set()

ans = 0



for i in range(n):

    if e[a[i]] == True:

        Alice.add(a[i])

        for j in range(a[i], amax, a[i]):

            e[j] = False

    else:

        if a[i] in Alice:

            Bob.add(a[i])



print((len(Alice - Bob)))
def main():

    from sys import stdin

    n = int(eval(input()))

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

    a.sort()

    amax = max(a)+1

    e = [True]*amax

    Alice = set()

    Bob = set()

    ans = 0

    

    for i in range(n):

        if e[a[i]] == True:

            Alice.add(a[i])

            for j in range(a[i], amax, a[i]):

                e[j] = False

        else:

            if a[i] in Alice:

                Bob.add(a[i])

    

    print((len(Alice - Bob)))

if __name__ == "__main__":

    main()
from sys import stdin

n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a) + 1
e = [True] * amax
Alice = set()
Bob = set()
ans = 0
for i in range(n):
    if e[a[i]] == True:
        Alice.add(a[i])
        for j in range(a[i], amax, a[i]):
            e[j] = False
    else:
        if a[i] in Alice:
            Bob.add(a[i])
print((len(Alice - Bob)))

def main():
    from sys import stdin

    n = int(eval(input()))
    a = list(map(int, stdin.readline().split()))
    a.sort()
    amax = max(a) + 1
    e = [True] * amax
    Alice = set()
    Bob = set()
    ans = 0
    for i in range(n):
        if e[a[i]] == True:
            Alice.add(a[i])
            for j in range(a[i], amax, a[i]):
                e[j] = False
        else:
            if a[i] in Alice:
                Bob.add(a[i])
    print((len(Alice - Bob)))


if __name__ == "__main__":
    main()

-from sys import stdin +def main(): +    from sys import stdin -n = int(eval(input())) -a = list(map(int, stdin.readline().split())) -a.sort() -amax = max(a) + 1 -e = [True] * amax -Alice = set() -Bob = set() -ans = 0 -for i in range(n): -    if e[a[i]] == True: -        Alice.add(a[i]) -        for j in range(a[i], amax, a[i]): -            e[j] = False -    else: -        if a[i] in Alice: -            Bob.add(a[i]) -print((len(Alice - Bob))) +    n = int(eval(input())) +    a = list(map(int, stdin.readline().split())) +    a.sort() +    amax = max(a) + 1 +    e = [True] * amax +    Alice = set() +    Bob = set() +    ans = 0 +    for i in range(n): +        if e[a[i]] == True: +            Alice.add(a[i]) +            for j in range(a[i], amax, a[i]): +                e[j] = False +        else: +            if a[i] in Alice: +                Bob.add(a[i]) +    print((len(Alice - Bob))) + + +if __name__ == "__main__": +    main()