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

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
maxA = A[len(A) - 1]
valid = [True] * (maxA + 1)
for i in range(1, len(valid)):
    if valid[i] == False or not i in A:
        continue
    else:
        for j in range(2, maxA // i + 1):
            valid[j * i] = False
count = 0
for i in range(len(A)):
    if i == 0 and A[i] == A[i+1]:
        continue
    if i != 0 and A[i-1] == A[i]:
        continue
    if valid[A[i]]:
        count += 1
print(count)


Fixed submission:
import math

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
maxA = A[len(A)-1]
valid = [True] * maxA

for i in range(len(A)):
    if valid[A[i]-1] == False:
        continue
    if i != 0 and A[i-1] == A[i]:
        valid[A[i]-1] = False
    else:
        for j in range(A[i]*2, maxA+1, A[i]):
            valid[j-1] = False

count = 0
for i in range(len(A)):
    if valid[A[i]-1] == True:
        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
valid = [True] * len(A)
sqrt = A[len(A)-1] // 2
stop = -1
for i in range(len(A)):
    if A[i] > sqrt:
        stop = i
        break
    if valid[i] == False:
        continue
    for j in range(i+1, len(A)):
        if valid[j] == False:
            continue
        if A[j] % A[i] == 0:
            valid[j] = False
        if A[j] == A[i]:
            valid[i] = False
if stop != -1:
    cur = A[stop]
    for i in range(stop+1, len(A)):
        if cur == A[i]:
            valid[i-1] = valid[i] = False
        else:
            cur = A[i]
print(valid.count(True))


Fixed submission:
import math

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
maxA = A[len(A)-1]
valid = [True] * maxA

for i in range(len(A)):
    if valid[A[i]-1] == False:
        continue
    if i != 0 and A[i-1] == A[i]:
        valid[A[i]-1] = False
    else:
        for j in range(A[i]*2, maxA+1, A[i]):
            valid[j-1] = False

count = 0
for i in range(len(A)):
    if valid[A[i]-1] == True:
        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
valid = [True] * len(A)
sqrt = A[len(A)-1] // 2
stop = -1
for i in range(len(A)):
    if A[i] > sqrt:
        stop = i
        break
    if valid[i] == False:
        continue
    for j in range(i+1, len(A)):
        if A[j] % A[i] == 0:
            valid[j] = False
        if A[j] == A[i]:
            valid[i] = False
if stop != -1:
    cur = A[stop]
    for i in range(stop+1, len(A)):
        if cur == A[i]:
            valid[i-1] = valid[i] = False
        else:
            cur = A[i]
print(valid.count(True))


Fixed submission:
import math

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
maxA = A[len(A)-1]
valid = [True] * maxA

for i in range(len(A)):
    if valid[A[i]-1] == False:
        continue
    if i != 0 and A[i-1] == A[i]:
        valid[A[i]-1] = False
    else:
        for j in range(A[i]*2, maxA+1, A[i]):
            valid[j-1] = False

count = 0
for i in range(len(A)):
    if valid[A[i]-1] == True:
        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
count = [True] * len(A)
sames = []
nums = []
for i in range(len(A)):
    if count[i] == False:
        continue
    divided = False
    for num in nums:
        if A[i] == num and not num in sames:
            sames.append(num)
        if A[i] % num == 0:
            divided = True
            count[i] = False
            break
    if not divided:
        nums.append(A[i])
        
print(count.count(True)-len(sames))


Fixed submission:
import math

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
maxA = A[len(A)-1]
valid = [True] * maxA

for i in range(len(A)):
    if valid[A[i]-1] == False:
        continue
    if i != 0 and A[i-1] == A[i]:
        valid[A[i]-1] = False
    else:
        for j in range(A[i]*2, maxA+1, A[i]):
            valid[j-1] = False

count = 0
for i in range(len(A)):
    if valid[A[i]-1] == True:
        count += 1
print(count)