Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
A.sort()
inf=10**2+1
t=[True for i in range(inf)]

ans=0
for j in range(len(A)):
    if j==len(A)-1 and t[A[j]]:
        ans+=1
    if t[A[j]] and j+1<=N-1 and A[j+1]!=A[j]:
        ans+=1
        for nums in range(A[j],inf,A[j]):
            t[nums]=False
print(ans)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A.sort()
inf=10**6+1
t=[True for i in range(inf)]

ans=0
for j in range(N):
    if j+1<=N-1 and t[A[j]]:
        if A[j+1]!=A[j]:
            ans+=1
        else:
            t[A[j]]=False
        for numb in range(A[j],inf,A[j]):
            t[numb]=False
    elif j==N-1 and t[A[j]]:
        ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N=int(input())
Ain=list(map(int,input().split())) 
ain=collections.Counter(Ain)
ansn=0
A=set(Ain)
A=list(A)
A.sort()
A2=list(t for t in A)


ans=[]
while len(A2)!=0:
    ans.append(A2[0])
    templist=[]
    for j in range(len(A2)):
        if A2[j]%A2[0]==0:
            templist.append(j)
    for s in reversed(templist):
        del A2[s]

for anss in ans:
    if ain[anss]==1:
        ansn+=1
print(ansn)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A.sort()
inf=10**6+1
t=[True for i in range(inf)]

ans=0
for j in range(N):
    if j+1<=N-1 and t[A[j]]:
        if A[j+1]!=A[j]:
            ans+=1
        else:
            t[A[j]]=False
        for numb in range(A[j],inf,A[j]):
            t[numb]=False
    elif j==N-1 and t[A[j]]:
        ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
Ain=list(map(int,input().split())) 
ansn=0
A=set(Ain)
A=list(A)
A.sort()
A2=list(t for t in A)


ans=[]
while len(A2)!=0:
    ans.append(A2[0])
    templist=[]
    for j in range(len(A2)):
        if A2[j]%A2[0]==0:
            templist.append(j)
    for s in reversed(templist):
        del A2[s]

for anss in ans:
    if Ain.count(anss)==1:
        ansn+=1
print(ansn)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A.sort()
inf=10**6+1
t=[True for i in range(inf)]

ans=0
for j in range(N):
    if j+1<=N-1 and t[A[j]]:
        if A[j+1]!=A[j]:
            ans+=1
        else:
            t[A[j]]=False
        for numb in range(A[j],inf,A[j]):
            t[numb]=False
    elif j==N-1 and t[A[j]]:
        ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
Ain=list(map(int,input().split())) 
ansn=0
A=set(Ain)
A=list(A)
A.sort()
A2=list(t for t in A)


ans=[]
while len(A2)!=0:
    ans.append(A2[0])
    temp=[]
    for facs in A2:
        if facs%A2[0]==0:
            temp.append(facs)
    for temps in temp:
        A2.remove(temps)

for anss in ans:
    if Ain.count(anss)==1:
        ansn+=1
print(ansn)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A.sort()
inf=10**6+1
t=[True for i in range(inf)]

ans=0
for j in range(N):
    if j+1<=N-1 and t[A[j]]:
        if A[j+1]!=A[j]:
            ans+=1
        else:
            t[A[j]]=False
        for numb in range(A[j],inf,A[j]):
            t[numb]=False
    elif j==N-1 and t[A[j]]:
        ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
Ain=list(map(int,input().split())) 
ans=0
A=set(Ain)
A=list(A)
A.sort()
A2=list(t for t in A)

for i in range(1,len(A)):
    for div in A2:
        if div<A[i] and A[i]%div==0:
            A2.remove(A[i])
            break
        elif div==A[i] and Ain.count(A[i])==1:
            ans+=1

if Ain.count(A[0])==1:
    ans+=1

print(ans)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A.sort()
inf=10**6+1
t=[True for i in range(inf)]

ans=0
for j in range(N):
    if j+1<=N-1 and t[A[j]]:
        if A[j+1]!=A[j]:
            ans+=1
        else:
            t[A[j]]=False
        for numb in range(A[j],inf,A[j]):
            t[numb]=False
    elif j==N-1 and t[A[j]]:
        ans+=1

print(ans)