Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
lineup=sorted([int(x) for x in input().split()])
duplicate={}
for i in lineup:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1
sieve=[1]*(max(lineup)+2)
counter=0
for i in range(N):
	for j in range(lineup[i]*2,max(lineup)+1,lineup[i]):
		sieve[j]=0

	if duplicate[lineup[i]]==1 and sieve[lineup[i]]==1:
		counter+=1
print(counter)

Fixed submission:
N=int(input())
lineup=sorted([int(x) for x in input().split()])
duplicate={}
for i in lineup:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1
b=max(lineup)+1
sieve=[1]*(b)
counter=0
for i in range(N):
	for j in range(lineup[i]*2,b,lineup[i]):
		sieve[j]=0
	if duplicate[lineup[i]]==1 and sieve[lineup[i]]==1:
		counter+=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
array=sorted([int(x) for x in sys.stdin.readline().split()])
duplicate={}
#check for duplicates
for i in array:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1
#loop from the list to check which are divisible and mark them as False
for i in range(N):
	if array[i]==False:
		continue
	for j in range(i+1,N):
		if array[j]==False:
			continue
		if array[j]%array[i]==0:
			array[j]=False

#remove all False
array=[x for x in array if x!=False]

#after that if the only remaining are duplicates, mark them as False
for i in range(len(array)):
	if duplicate[array[i]]>1:
		array[i]=False

#remove all False
array=[x for x in array if x!=False]

print(len(array))


Fixed submission:
N=int(input())
lineup=sorted([int(x) for x in input().split()])
duplicate={}
for i in lineup:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1
b=max(lineup)+1
sieve=[1]*(b)
counter=0
for i in range(N):
	for j in range(lineup[i]*2,b,lineup[i]):
		sieve[j]=0
	if duplicate[lineup[i]]==1 and sieve[lineup[i]]==1:
		counter+=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
array=sorted([int(x) for x in sys.stdin.readline().split()])
duplicate={}
for i in array:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1







for i in range(N):
	for j in range(i+1,N):
		if array[i]==False:
			break
		if array[j]%array[i]==0:
			array[j]=False

array=[x for x in array if x!=False]
for i in range(len(array)):
	if duplicate[array[i]]>1:
		array[i]=False
array=[x for x in array if x!=False]

print(len(array))

Fixed submission:
N=int(input())
lineup=sorted([int(x) for x in input().split()])
duplicate={}
for i in lineup:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1
b=max(lineup)+1
sieve=[1]*(b)
counter=0
for i in range(N):
	for j in range(lineup[i]*2,b,lineup[i]):
		sieve[j]=0
	if duplicate[lineup[i]]==1 and sieve[lineup[i]]==1:
		counter+=1
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
array=sorted([int(x) for x in input().split()])
duplicate={}
for i in array:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1







for i in range(N):
	for j in range(i+1,N):
		if array[i]==False:
			break
		if array[j]%array[i]==0:
			array[j]=False

array=[x for x in array if x!=False]
for i in range(len(array)):
	if duplicate[array[i]]>1:
		array[i]=False
array=[x for x in array if x!=False]

print(len(array))

Fixed submission:
N=int(input())
lineup=sorted([int(x) for x in input().split()])
duplicate={}
for i in lineup:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1
b=max(lineup)+1
sieve=[1]*(b)
counter=0
for i in range(N):
	for j in range(lineup[i]*2,b,lineup[i]):
		sieve[j]=0
	if duplicate[lineup[i]]==1 and sieve[lineup[i]]==1:
		counter+=1
print(counter)