Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A.sort()

ans = 0

pre = -1

while A:
    maxim = A.pop()
    if maxim == pre:continue

    for item in A:
        if maxim % item == 0:
            ans -= 1
            break
    ans += 1
    pre = maxim

print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

cnt = {}

for item in a:
    if item not in cnt:
        cnt[item] = 0
    cnt[item] += 1

A = list(set(a))

candidate = []

for item in A:
    if cnt[item] == 1:
        candidate.append(item)

judge = [True] *(10**6 + 1)

for item in A:
    for i in range(2, ((10**6)//item) + 1):
        judge[item*i] = False

ans = 0

for item in candidate:
    if judge[item]:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N = int(input())
a = list(map(int, input().split()))

a.sort()

A = deque(a)

ans = 0

pre = -1

while A:
    maxim = A.pop()
    if maxim == pre:continue

    for item in A:
        if maxim % item == 0:
            ans -= 1
            break
    ans += 1
    pre = maxim

print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

cnt = {}

for item in a:
    if item not in cnt:
        cnt[item] = 0
    cnt[item] += 1

A = list(set(a))

candidate = []

for item in A:
    if cnt[item] == 1:
        candidate.append(item)

judge = [True] *(10**6 + 1)

for item in A:
    for i in range(2, ((10**6)//item) + 1):
        judge[item*i] = False

ans = 0

for item in candidate:
    if judge[item]:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A.sort()

ans = 0

pre = -1

while A:
    maxim = A.pop()
    if maxim == pre:continue

    for item in A:
        if maxim % item == 0:
            ans -= 1
            break
    ans += 1
    pre = maxim

print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

cnt = {}

for item in a:
    if item not in cnt:
        cnt[item] = 0
    cnt[item] += 1

A = list(set(a))

candidate = []

for item in A:
    if cnt[item] == 1:
        candidate.append(item)

judge = [True] *(10**6 + 1)

for item in A:
    for i in range(2, ((10**6)//item) + 1):
        judge[item*i] = False

ans = 0

for item in candidate:
    if judge[item]:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A.sort()

ans = 0

pre = -1

while A:
    maxim = A.pop()
    if maxim == pre:continue

    for item in A:
        if maxim % item == 0:
            ans -= 1
            break
    ans += 1
    pre = maxim

print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

cnt = {}

for item in a:
    if item not in cnt:
        cnt[item] = 0
    cnt[item] += 1

A = list(set(a))

candidate = []

for item in A:
    if cnt[item] == 1:
        candidate.append(item)

judge = [True] *(10**6 + 1)

for item in A:
    for i in range(2, ((10**6)//item) + 1):
        judge[item*i] = False

ans = 0

for item in candidate:
    if judge[item]:
        ans += 1

print(ans)