Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
maxa = max(a)

dp = {i: 0 for i in range(1, dp+1)}

ans = 0
for i in range(n):
    if dp[a[i]] == 1:
        continue

    if i == n - 1 or a[i] != a[i+1]:
        ans += 1

    prime += a[i]
    while prime <= maxa:
        dp[prime] = 1
        prime += a[i]
    
print(ans)

Fixed submission:
n = int(input())
*A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
maxa = max(a)

dp = {i: 0 for i in a}
for elem in a:
    t = 2
    while elem * t <= maxa:
        dp[elem * t] = 1
        t += 1

ans = 0
for elem in a:
    if dp[elem] == 0 and a.count(elem) == 1:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
*A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
maxa = max(a)

dp = {i+1: 0 for i in range(maxa)}
for elem in a:
    t = 2
    while elem * t <= maxa:
        dp[elem * t] = 1
        t += 1

ans = 0
for elem in a:
    if dp[elem] == 0 and a.count(elem) == 1:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
*A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
*A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))

# print(li)
li.sort()
# print(li)

one = [1 for _ in range(n)]

if li[0] == li[1]:
    one[0] = 0

check = set([i for i in range(1, n)])

for i in range(n-1):
    a = set([_ for _ in range(i+1, n)]) & check
    # print(a)
    for j in a:
        if li[j] % li[i] == 0:
            one[j] = 0
            check.remove(j)
    check = set(list(check)[1:])
print(sum(one))


Fixed submission:
n = int(input())
*A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))

# print(li)
li.sort()
# print(li)

one = [1 for _ in range(n)]

if li[0] == li[1]:
    one[0] = 0

check = [i for i in range(1, n)]

for i in range(n-1):
    a = set([_ for _ in range(i+1, n)]) & set(check)
    for j in a:
        if li[j] % li[i] == 0:
            one[j] = 0
    del check[0]
print(sum(one))


Fixed submission:
n = int(input())
*A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)