Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


N = int(input())
A = list(map(int, input().split()))
setA = set(A)
dup = set([x for x in setA if A.count(x) > 1])

count = 0
for i in range(len(A)):
    flag = False
    if A[i] in dup:
        continue
    for div in make_divisors(A[i]):
        if div == A[i]:
            continue
        elif div in setA:
            flag = True
            break
    if not flag:
        count += 1

print(count)


Fixed submission:
# エラトステネスの篩

N = int(input())
A = sorted(map(int, input().split()))
maxA = A[N - 1]
dp = [0] * (maxA + 1)

for i in range(len(A)):
    cursor = A[i]
    while cursor <= maxA:
        dp[cursor] += 1
        cursor += A[i]

ans = 0
for a in A:
    if dp[a] == 1:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
import sympy

N = int(input())
A = list(map(int, input().split()))
setA = set(A)

count = 0
for i in range(len(A)):
    flag = False
    for div in sympy.divisors(A[i]):
        if div <= 1:
            continue
        if div == A[i]:
            if div in A[:i]:
                flag = True
                break
            if div in A[i+1:]:
                flag = True
                break
        else:
            if div in setA:
                flag = True
                break
    if not flag:
        count += 1

print(count)


Fixed submission:
# エラトステネスの篩

N = int(input())
A = sorted(map(int, input().split()))
maxA = A[N - 1]
dp = [0] * (maxA + 1)

for i in range(len(A)):
    cursor = A[i]
    while cursor <= maxA:
        dp[cursor] += 1
        cursor += A[i]

ans = 0
for a in A:
    if dp[a] == 1:
        ans += 1

print(ans)

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

A.sort()

count = 0
for i in range(len(A)):
    if A[i] in A[:i]:
        continue
    if A[i] in A[i+1:]:
        continue
    flag = False
    for j in range(0, i):
        if (A[i] % A[j] == 0):
            flag = True
            break
    if not flag:
        count += 1

print(count)


Fixed submission:
# エラトステネスの篩

N = int(input())
A = sorted(map(int, input().split()))
maxA = A[N - 1]
dp = [0] * (maxA + 1)

for i in range(len(A)):
    cursor = A[i]
    while cursor <= maxA:
        dp[cursor] += 1
        cursor += A[i]

ans = 0
for a in A:
    if dp[a] == 1:
        ans += 1

print(ans)

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

A.sort()

count = 0
for i in range(len(A)):
    if A[i] in A[:i]:
        continue
    if A[i] in A[i+1:]:
        continue
    flag = False
    for j in range(0, i):
        if (A[i] % A[j] == 0):
            flag = True
            break
    if not flag:
        count += 1

print(count)


Fixed submission:
# エラトステネスの篩

N = int(input())
A = sorted(map(int, input().split()))
maxA = A[N - 1]
dp = [0] * (maxA + 1)

for i in range(len(A)):
    cursor = A[i]
    while cursor <= maxA:
        dp[cursor] += 1
        cursor += A[i]

ans = 0
for a in A:
    if dp[a] == 1:
        ans += 1

print(ans)