Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def divisors(n):
    lst = []; i = 1
    while i ** 2 <= n:
        q, r = divmod(n, i)
        if r == 0:
            lst.append(i)
            if i != q: lst.append(q)
        i += 1
    return lst

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
cnt = [0] * (10**6 + 1)
for a in A: cnt[a] += 1
ans = 0
for a in A:
    if cnt[a] > 1: continue
    for i in divisors(a):
        if i == a: continue
        if cnt[i] >= 1: break
    else:
        ans += 1
print(ans)


Fixed submission:
from collections import Counter

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
*A, = map(int, input().split())
A = sorted(A)
cnt = [0] * (10**6 + 1)
for a in A: cnt[a] += 1
checked = [True] * N
ans = 0
for i, a in enumerate(A):
    if not checked[i]: continue
    flag = True
    for j in range(i+1, N):
        if A[j] % a == 0:
            checked[j] = False
            if A[j] == a: flag = False
    if flag: ans += 1 
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
*A, = map(int, input().split())
A = sorted(A)
checked = [True] * N
ans = 0
for i, a in enumerate(A):
    if not checked[i]: continue
    flag = True
    for j in range(i+1, N):
        if A[j] % a == 0:
            checked[j] = False
            if A[j] == a: flag = False
    if flag: ans += 1 
print(ans)


Fixed submission:
from collections import Counter

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def divisors(n):
    lst = []; i = 1
    while i ** 2 <= n:
        q, r = divmod(n, i)
        if r == 0:
            lst.append(i)
            if i != q: lst.append(q)
        i += 1
    return lst

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
cnt = [0] * (10**6 + 1)
for a in A: cnt[a] += 1
ans = 0
for a in A:
    if cnt[a] > 1: continue
    for i in divisors(a):
        if i == a: continue
        if cnt[i] >= 1: break
    else:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
def divisors(n):
    lst = []; i = 1
    while i ** 2 <= n:
        q, r = divmod(n, i)
        if r == 0:
            lst.append(i)
            if i != q: lst.append(q)
        i += 1
    return lst

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
cnt = Counter(A)
ans = 0
for a in A:
    if cnt[a] > 1: continue
    for i in divisors(a):
        if i == a: continue
        if cnt[i] >= 1: break
    else:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
*A, = map(int, input().split())
A = sorted(A)
checked = [True] * N
ans = 0
for i, a in enumerate(A):
    if not checked[i]: continue
    flag = True
    for j in range(i+1, N):
        if A[j] % a == 0:
            checked[j] = False
            if A[j] == a: flag = False
    if flag: ans += 1 
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
def divisors(n):
    lst = []; i = 1
    while i ** 2 <= n:
        q, r = divmod(n, i)
        if r == 0:
            lst.append(i)
            if i != q: lst.append(q)
        i += 1
    return lst

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
cnt = Counter(A)
ans = 0
for a in A:
    if cnt[a] > 1: continue
    for i in divisors(a):
        if i == a: continue
        if cnt[i] >= 1: break
    else:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)