Buggy python submission (verdict: Time Limit Exceeded):
# review
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    ans = 0
    OK = [True for i in range(10**6+1)]
    CNT = [0 for i in range(10**6+1)]
    for x in A:
        CNT[x] += 1
        for i in range(2, 10**6+1):
            if i*x > 10**6:
                break
            OK[i*x] = False
    for x in A:
        if CNT[x] == 1 and OK[x]:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# review series
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
A.sort()
divisible = [False for i in range(10**6+1)]
for x in A:
    cnt = 2*x
    while cnt <= 10**6:
        divisible[cnt] = True
        cnt += x
D = dict(Counter(A))
ans = 0
for key, value in D.items():
    if D[key] == 1 and divisible[key] == False:
        ans += 1
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)



Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = set(A)
B = dict(Counter(A))

n = 10**6
prime = {i for i in range(2, n)}
for i in range(2, n):
    if i in prime:
        for j in range(i*2, n, i):
            if j in prime:
                prime.remove(j)
ans = 0
for i in range(N):
    if B[A[i]] > 1:
        pass
    else:
        if A[i] in prime: 
            ans+=1 
            continue
        flag = True
        for j in range(1, A[i]+1):
            if A[i] % j == 0:
                if A[i]//j in C:
                    if A[i]//j < A[i]:
                        flag = False
                        break
                if j in C:
                    if j < A[i]:
                        flag = False
                        break
            if j**2 > A[i]:
                flag = False
        ans += flag(int)
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = set(A)
B = dict(Counter(A))
ans = 0
for i in range(N):
    if B[A[i]] > 1:
        pass
    else:
        flag = True
        for j in range(1, A[i]+1):
            if j**2 > A[i]:
                break
            if A[i] % j == 0:
                if A[i]//j in C:
                    if A[i]//j < A[i]:
                        flag = False
                        break
                if j in C:
                    if j < A[i]:
                        flag = False
                        break

        ans += int(flag)
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(N):
    cnt = 0
    for j in range(N):
        if A[i] % A[j] == 0:
            cnt += 1
            if A[j] > A[i]:
                break
    if cnt == 1:
        ans += 1
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
A.sort()


ans = 0
for i in range(N):
    if D[A[i]] == 1:
        flag=True
        cnt=0
        for j in range(i):
            if A[i] % A[j] == 0:
                cnt+=1

            if A[j]**2 > A[i]:
                break
        if cnt==1:
            ans += 1
    else:
        pass
    
print(ans)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
A.sort()
D = dict(Counter(A))

n = 10**6
prime = {i for i in range(2, n)}
for i in range(2, n):
    if i in prime:
        for j in range(i*2, n, i):
            if j in prime:
                prime.remove(j)
ans = 0
for i in range(N):
    if D[A[i]] == 1:
        if (A[i] in prime) or (A[i] == 1):
            ans += 1
        else:
            cnt=0
            for j in range(i):
                if A[i] % A[j] == 0:
                    flag = False 
                    break
                if A[j]**2 > A[i]:
                    break
            if flag:
                ans += 1

print(ans)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
a = list(map(int, input().split()))
D = dict(Counter(a))
E = []
for key in D.keys():
    if D[key] == 1:
        E.append(key)

E = set(E)

for d in a:
    for j in range(2, max(E)//d+3):
        if d*j in E:
            E.remove(j*d)
print(len(E))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)