n = int(eval(input()))

l = [int(x) for x in input().split()]

D = set() #Duplication

S = set() #all

for x in l:

    if x in S:

        D.add(x)

    else:

        S.add(x)



limit = 10**6+1

mp = [0]*(limit)



cnt = 0

S = sorted(S)

for x in S:

    for y in range(x,limit,x):

        mp[y] += 1

    if(x in D):

        continue

    if(mp[x]==1):

        cnt += 1

        

print(cnt)







n = int(eval(input()))

l = [int(x) for x in input().split()]

D = set() #Duplication

S = set() #all

for x in l:

    if x in S:

        D.add(x)

    else:

        S.add(x)



M = max(S)

limit = M+1

mp = [0]*(limit)



cnt = 0

S = sorted(S)

for x in S:

    for y in range(x,limit,x):

        mp[y] += 1

    if(x in D):

        continue

    if(mp[x]==1):

        cnt += 1

        

print(cnt)







n = int(eval(input()))
l = [int(x) for x in input().split()]
D = set()  # Duplication
S = set()  # all
for x in l:
    if x in S:
        D.add(x)
    else:
        S.add(x)
limit = 10**6 + 1
mp = [0] * (limit)
cnt = 0
S = sorted(S)
for x in S:
    for y in range(x, limit, x):
        mp[y] += 1
    if x in D:
        continue
    if mp[x] == 1:
        cnt += 1
print(cnt)

n = int(eval(input()))
l = [int(x) for x in input().split()]
D = set()  # Duplication
S = set()  # all
for x in l:
    if x in S:
        D.add(x)
    else:
        S.add(x)
M = max(S)
limit = M + 1
mp = [0] * (limit)
cnt = 0
S = sorted(S)
for x in S:
    for y in range(x, limit, x):
        mp[y] += 1
    if x in D:
        continue
    if mp[x] == 1:
        cnt += 1
print(cnt)

-limit = 10**6 + 1 +M = max(S) +limit = M + 1