Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import math
import sys


def input():
    return sys.stdin.readline()[:-1]


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def make_divisors(n):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n and i in c:
                return False

            tmp = n // i
            if i != tmp:
                if tmp != n and tmp in c:
                    return False
    return True


N = int(input())
A = list(map(int, input().split()))

c = Counter(A)

# 1がある時
if 1 in c:
    if c[1] >= 2:
        print(0)
    else:
        print(1)
    exit(0)

ans = 0
for a in A:
    # 同じ数が複数ある
    if c[a] >= 2:
        continue

    # 1と同数がなくて素数なら割り切れる数はない
    if is_prime(a):
        ans += 1
        continue

    # 約数があるか
    if make_divisors(a):
        ans += 1

print(ans)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
p = [True]*(10**6+1)

for k, v in c.items():
    t = k*2
    while t <= 10**6:
        p[t] = False
        t += k

ans = 0
for a in A:
    if c[a] == 1 and p[a]:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):

N = int(input())
A = list(map(int, input().split()))

A.sort()
a_list = [A[0]]
ans = 0
if A[0] != A[1]:
    ans += 1
for i in range(1, N):
    if A[i] == A[i-1]:
        continue
    for a in a_list:
        if A[i] % a == 0:
            break
    else:
        a_list.append(A[i])
        ans += 1

print(ans)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
p = [True]*(10**6+1)

for k, v in c.items():
    t = k*2
    while t <= 10**6:
        p[t] = False
        t += k

ans = 0
for a in A:
    if c[a] == 1 and p[a]:
        ans += 1
print(ans)

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


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def make_divisors(n):

    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n and i in c:
                return False

            tmp = n // i
            if i != tmp:
                if tmp != n and tmp in c:
                    return False
    return True


N = int(input())
A = list(map(int, input().split()))

c = Counter(A)

# 1がある時
if 1 in c:
    if c[1] >= 2:
        print(0)
    else:
        print(1)
    exit(0)

ans = 0
for a in A:
    # 同じ数が複数ある
    if c[a] >= 2:
        continue

    # 1と同数がなくて素数なら割り切れる数はない
    if is_prime(a):
        ans += 1
        continue

    # 約数があるか
    if make_divisors(a):
        ans += 1

print(ans)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
p = [True]*(10**6+1)

for k, v in c.items():
    t = k*2
    while t <= 10**6:
        p[t] = False
        t += k

ans = 0
for a in A:
    if c[a] == 1 and p[a]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

prime = {2: True, 3: True, 5: True, 7: True, 11: True, 13: True, 17: True, 19: True, 23: True, 29: True, 31: True, 37: True, 41: True, 43: True, 47: True, 53: True, 59: True, 61: True, 67: True, 71: True, 73: True, 79: True, 83: True, 89: True, 97: True, 101: True, 103: True, 107: True, 109: True, 113: True, 127: True, 131: True, 137: True, 139: True, 149: True, 151: True, 157: True, 163: True, 167: True, 173: True, 179: True, 181: True, 191: True, 193: True, 197: True, 199: True, 211: True, 223: True, 227: True, 229: True, 233: True, 239: True, 241: True, 251: True, 257: True, 263: True, 269: True, 271: True, 277: True, 281: True, 283: True, 293: True, 307: True, 311: True, 313: True, 317: True, 331: True, 337: True, 347: True, 349: True, 353: True, 359: True, 367: True, 373: True, 379: True, 383: True, 389: True, 397: True, 401: True, 409: True, 419: True, 421: True, 431: True, 433: True, 439: True, 443: True, 449: True, 457: True, 461: True, 463: True, 467: True, 479: True,
         487: True, 491: True, 499: True, 503: True, 509: True, 521: True, 523: True, 541: True, 547: True, 557: True, 563: True, 569: True, 571: True, 577: True, 587: True, 593: True, 599: True, 601: True, 607: True, 613: True, 617: True, 619: True, 631: True, 641: True, 643: True, 647: True, 653: True, 659: True, 661: True, 673: True, 677: True, 683: True, 691: True, 701: True, 709: True, 719: True, 727: True, 733: True, 739: True, 743: True, 751: True, 757: True, 761: True, 769: True, 773: True, 787: True, 797: True, 809: True, 811: True, 821: True, 823: True, 827: True, 829: True, 839: True, 853: True, 857: True, 859: True, 863: True, 877: True, 881: True, 883: True, 887: True, 907: True, 911: True, 919: True, 929: True, 937: True, 941: True, 947: True, 953: True, 967: True, 971: True, 977: True, 983: True, 991: True, 997: True, 1009: True, 1013: True, 1019: True, 1021: True, 1031: True, 1033: True, 1039: True, 1049: True, 1051: True, 1061: True, 1063: True, 1069: True}


def make_divisors(n):

    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n and i in c:
                return False

            tmp = n // i
            if i != tmp:
                if tmp != n and tmp in c:
                    return False
    return True


N = int(input())
A = list(map(int, input().split()))

c = Counter(A)

# 1がある時
if 1 in c:
    if c[1] >= 2:
        print(0)
    else:
        print(1)
    exit(0)

ans = 0
for a in A:
    # 同じ数が複数ある
    if c[a] >= 2:
        continue

    # 素数の時
    if a in prime:
        ans += 1
        continue

    # 小さい数の倍数であるか
    for i in [2, 3, 5, 7, 11, 13]:
        if i in c:
            if a % i == 0:
                break
    else:
        # 約数を取得
        if make_divisors(a):
            ans += 1

print(ans)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
p = [True]*(10**6+1)

for k, v in c.items():
    t = k*2
    while t <= 10**6:
        p[t] = False
        t += k

ans = 0
for a in A:
    if c[a] == 1 and p[a]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter


def make_divisors(n):

    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n and i in c:
                return False

            tmp = n // i
            if i != tmp:
                if tmp != n and tmp in c:
                    return False
    return True


N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
ans = 0
for a in A:
    # 同じ数が複数ある
    if c[a] >= 2:
        continue

    # 約数を取得
    if make_divisors(a):
        ans += 1

print(ans)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
p = [True]*(10**6+1)

for k, v in c.items():
    t = k*2
    while t <= 10**6:
        p[t] = False
        t += k

ans = 0
for a in A:
    if c[a] == 1 and p[a]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
ans = 0
for a in A:
    # 同じ数が複数ある
    if c[a] >= 2:
        continue

    # 約数を取得
    divi = make_divisors(a)
    for d in divi:
        # チェック中と同じ値は無視
        if d == a:
            continue
        # 約数がハッシュにあるなら割り切れる数が1個はあるので性質を満たさない
        if d in c:
            break
    # 約数が1個もハッシュにない＝割り切れる数がないので性質を満たす
    else:
        ans += 1
print(ans)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
p = [True]*(10**6+1)

for k, v in c.items():
    t = k*2
    while t <= 10**6:
        p[t] = False
        t += k

ans = 0
for a in A:
    if c[a] == 1 and p[a]:
        ans += 1
print(ans)