Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()
temp = plst[:]
jdg = [True]*N
ans = 0
#while temp:
for l, q in enumerate(plst):
    if not jdg[l]: continue

    for j in range(l+1, N):
        if plst[j]%q==0: jdg[j]=False
    if cnt[q] == 1: ans += 1
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()

ans = [0] * (plst[-1] + 1)

for i in range(len(plst)):
    for j in range(plst[i], plst[-1]+1, plst[i]):
        ans[j] += 1
d = 0
for i in range(len(plst)):
    if ans[plst[i]]==1 and cnt[plst[i]]==1: d += 1
print(d)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort(reverse=True)
temp = plst[:]
ans = 0
while temp:
    q = temp.pop()
    lst = []
    for i in temp:
        if i%q!=0: lst.append(i)
    if cnt[q] == 1: ans += 1
    temp = lst[:]

print(ans)

Fixed submission:
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()

ans = [0] * (plst[-1] + 1)

for i in range(len(plst)):
    for j in range(plst[i], plst[-1]+1, plst[i]):
        ans[j] += 1
d = 0
for i in range(len(plst)):
    if ans[plst[i]]==1 and cnt[plst[i]]==1: d += 1
print(d)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()
temp = plst[:]
ans = 0
while temp:
    q = temp[0]
    lst = []
    for i in temp:
        if i%q!=0: lst.append(i)
    if cnt[q] == 1: ans += 1
    temp = lst[:]

print(ans)

Fixed submission:
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()

ans = [0] * (plst[-1] + 1)

for i in range(len(plst)):
    for j in range(plst[i], plst[-1]+1, plst[i]):
        ans[j] += 1
d = 0
for i in range(len(plst)):
    if ans[plst[i]]==1 and cnt[plst[i]]==1: d += 1
print(d)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()
temp = plst[:]
ans = 0
while temp:
    jdg = True
    q = temp[0]
    m = bisect.bisect_left(temp, 2*q)
    if len(temp)==1: lst = []
    else: lst = temp[1:m]
    for i in temp[m:]:
        if i%q!=0: lst.append(i)
    if cnt[q] == 1: ans += 1
    temp = lst[:]

print(ans)

Fixed submission:
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()

ans = [0] * (plst[-1] + 1)

for i in range(len(plst)):
    for j in range(plst[i], plst[-1]+1, plst[i]):
        ans[j] += 1
d = 0
for i in range(len(plst)):
    if ans[plst[i]]==1 and cnt[plst[i]]==1: d += 1
print(d)