Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A.sort()

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

nums = set()
used = set()
done = set()
ans = 0
for a in A:
    if a in used and a not in done:
        ans -= 1
        done.add(a)
    if make_divisors(a):
        if a not in used:
            ans += 1
            used.add(a)
    nums.add(a)
print(ans)

Fixed submission:
import sys
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A_counters = Counter(A)
A.sort()
A_set = set(A)
ans = 0
for a in A:
    if a in A_set:
        if A_counters[a] == 1:
            ans += 1
        for i in range(1, A[-1] // a + 1):
            if a * i in A_set:
                A_set.remove(a * i)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A.sort()
A_counters = Counter(A)

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

nums = set()
ans = 0
for a in A:
    if make_divisors(a) and A_counters[a] == 1:
        ans += 1
    nums.add(a)
print(ans)

Fixed submission:
import sys
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A_counters = Counter(A)
A.sort()
A_set = set(A)
ans = 0
for a in A:
    if a in A_set:
        if A_counters[a] == 1:
            ans += 1
        for i in range(1, A[-1] // a + 1):
            if a * i in A_set:
                A_set.remove(a * i)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A.sort()
A_counters = Counter(A)

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)
    return set(divisors)

nums = set()
ans = 0
for a in A:
    a_divs = make_divisors(a)
    if len(nums & a_divs) == 0 and A_counters[a] == 1:
        ans += 1
    nums.add(a)
print(ans)

Fixed submission:
import sys
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A_counters = Counter(A)
A.sort()
A_set = set(A)
ans = 0
for a in A:
    if a in A_set:
        if A_counters[a] == 1:
            ans += 1
        for i in range(1, A[-1] // a + 1):
            if a * i in A_set:
                A_set.remove(a * i)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import heapq
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A_counters = Counter(A)

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)
    return set(divisors)

heapq.heapify(A)

nums = set()
ans = 0
while A:
    a = heapq.heappop(A)
    a_divs = make_divisors(a)
    if len(nums & a_divs) == 0 and A_counters[a] == 1:
        ans += 1
    nums.add(a)
print(ans)

Fixed submission:
import sys
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A_counters = Counter(A)
A.sort()
A_set = set(A)
ans = 0
for a in A:
    if a in A_set:
        if A_counters[a] == 1:
            ans += 1
        for i in range(1, A[-1] // a + 1):
            if a * i in A_set:
                A_set.remove(a * i)
print(ans)