Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(set(map(int, input().split())))
N = len(A)
cnt = N
dp = [0 for _ in range(N)]
A.sort()
A_max = A[-1]
p = A[0]
i = 0
while p**2 < A_max:
    if dp[i] < 2:
        p = A[i]
        for j in range(N):
            if dp[j] < 2 and A[j]%p == 0:
                dp[j] += 1
                if dp[j] == 2:
                    cnt -= 1
    i += 1

for i in dp:
    if i >= 2:
        cnt -= 1
if len(A) == 1:
    print(0)
else:
    print(cnt)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
# dp = [0 for _ in range(N)]

# A.sort()

# for i in range(N):
#     if dp[i] < 2:
#         p = A[i]
#         for j in range(N):
#             if dp[j] < 2 and A[j]%p == 0 and A[j] >= p:
#                 dp[j] += 1
# cnt = 0
# for i in range(N):
#     if dp[i] == 1:
#         cnt += 1
M = 10**6  + 5
cnt = [0 for _ in range(M)]
for x in A:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    i = x
    while i < M:
        cnt[i] += 1
        i += x
ans = 0
for x in A:
    if cnt[x] == 1:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
dp = [0 for _ in range(N)]
A.sort()
A_max = A[-1]
p = A[0]
i = 0
while p**2 < A_max:
    if dp[i] < 2:
        p = A[i]
        for j in range(N):
            if dp[j] < 2 and A[j]%p == 0 and A[j] >= p:
                dp[j] += 1
    i += 1
cnt = 0
for i in range(N):
    if dp[i] == 1:
        cnt += 1

print(cnt)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
# dp = [0 for _ in range(N)]

# A.sort()

# for i in range(N):
#     if dp[i] < 2:
#         p = A[i]
#         for j in range(N):
#             if dp[j] < 2 and A[j]%p == 0 and A[j] >= p:
#                 dp[j] += 1
# cnt = 0
# for i in range(N):
#     if dp[i] == 1:
#         cnt += 1
M = 10**6  + 5
cnt = [0 for _ in range(M)]
for x in A:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    i = x
    while i < M:
        cnt[i] += 1
        i += x
ans = 0
for x in A:
    if cnt[x] == 1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
dp = [0 for _ in range(N)]

A.sort()

for i in range(N):
    if dp[i] < 2:
        p = A[i]
        for j in range(N):
            if dp[j] < 2 and A[j]%p == 0 and A[j] >= p:
                dp[j] += 1
cnt = 0
for i in range(N):
    if dp[i] == 1:
        cnt += 1

print(cnt)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
# dp = [0 for _ in range(N)]

# A.sort()

# for i in range(N):
#     if dp[i] < 2:
#         p = A[i]
#         for j in range(N):
#             if dp[j] < 2 and A[j]%p == 0 and A[j] >= p:
#                 dp[j] += 1
# cnt = 0
# for i in range(N):
#     if dp[i] == 1:
#         cnt += 1
M = 10**6  + 5
cnt = [0 for _ in range(M)]
for x in A:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    i = x
    while i < M:
        cnt[i] += 1
        i += x
ans = 0
for x in A:
    if cnt[x] == 1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
dp = [0 for _ in range(N)]

A.sort()

for i in range(N):
    if dp[i] < 2:
        p = A[i]
        for j in range(N):
            if dp[j] < 2 and A[j]%p == 0 and A[j] >= p:
                dp[j] += 1
cnt = 0
for i in range(N):
    if dp[i] == 1:
        cnt += 1

print(cnt)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
# dp = [0 for _ in range(N)]

# A.sort()

# for i in range(N):
#     if dp[i] < 2:
#         p = A[i]
#         for j in range(N):
#             if dp[j] < 2 and A[j]%p == 0 and A[j] >= p:
#                 dp[j] += 1
# cnt = 0
# for i in range(N):
#     if dp[i] == 1:
#         cnt += 1
M = 10**6  + 5
cnt = [0 for _ in range(M)]
for x in A:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    i = x
    while i < M:
        cnt[i] += 1
        i += x
ans = 0
for x in A:
    if cnt[x] == 1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
dp = [0 for _ in range(N)]

A.sort()

for i in range(N):
    if dp[i] < 2:
        p = A[i]
        for j in range(N):
            if A[j]%p == 0 and A[j] >= p:
                dp[j] += 1
cnt = 0
for i in range(N):
    if dp[i] == 1:
        cnt += 1

print(cnt)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
# dp = [0 for _ in range(N)]

# A.sort()

# for i in range(N):
#     if dp[i] < 2:
#         p = A[i]
#         for j in range(N):
#             if dp[j] < 2 and A[j]%p == 0 and A[j] >= p:
#                 dp[j] += 1
# cnt = 0
# for i in range(N):
#     if dp[i] == 1:
#         cnt += 1
M = 10**6  + 5
cnt = [0 for _ in range(M)]
for x in A:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    i = x
    while i < M:
        cnt[i] += 1
        i += x
ans = 0
for x in A:
    if cnt[x] == 1:
        ans += 1
print(ans)