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


n = int(input())
A = list(map(int, input().split()))
A.sort()
undivisible = set(range(1, 10**6+1))


def update(num):
    for div in list(undivisible):
        if div % num == 0:
            undivisible.discard(div)


counter = Counter(A)
ans = 0
for a, count in counter.items():
    if count == 1 and a in undivisible:
        ans += 1
        
    update(a)

print(ans)


Fixed submission:
import numpy as np
from collections import Counter


n = int(input())
A = list(map(int, input().split()))
A.sort()
is_divisible = np.zeros(10**6+1, dtype=np.int64)


def update(num):
    nums = np.arange(num, 10**6+1, num)
    is_divisible[nums] = True

counter = Counter(A)
ans = 0
for a, count in counter.items():
    if count == 1 and not is_divisible[a]:
        ans += 1
        
    update(a)

print(ans)

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


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


def divisor(n):
    div_list = []
    limit = int(n**0.5) + 1
    for div in range(1, limit):
        if n % div == 0:
            div2 = n // div
            div_list.append(div)
            if div != div2:
                div_list.append(div2)
    
    return div_list


        
A_dict = defaultdict(int)
for a in A:
    A_dict[a] += 1

    
ans = n
for a in A:
    divs = divisor(a)
    for div in divs:
        if div == a:
            
            if A_dict[div] >= 2:
                ans -= 1
                break
        else:
            if A_dict[div] >= 1:
                ans -= 1
                break
            

print(ans)

Fixed submission:
import numpy as np
from collections import Counter


n = int(input())
A = list(map(int, input().split()))
A.sort()
is_divisible = np.zeros(10**6+1, dtype=np.int64)


def update(num):
    nums = np.arange(num, 10**6+1, num)
    is_divisible[nums] = True

counter = Counter(A)
ans = 0
for a, count in counter.items():
    if count == 1 and not is_divisible[a]:
        ans += 1
        
    update(a)

print(ans)

Buggy python submission (verdict: Runtime Error):
IN = iter(Input.split('\n')).__next__
def input():
    return IN()

###################################################
from collections import defaultdict


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


def divisor(n):
    div_list = []
    limit = int(n**0.5) + 1
    for div in range(1, limit):
        if n % div == 0:
            div2 = n // div
            div_list.append(div)
            if div != div2:
                div_list.append(div2)
    
    return div_list


        
A_dict = defaultdict(int)
for a in A:
    A_dict[a] += 1

    
ans = n
for a in A:
    divs = divisor(a)
    for div in divs:
        if div == a:
            
            if A_dict[div] >= 2:
                ans -= 1
                break
        else:
            if A_dict[div] >= 1:
                ans -= 1
                break
            

print(ans)

Fixed submission:
import numpy as np
from collections import Counter


n = int(input())
A = list(map(int, input().split()))
A.sort()
is_divisible = np.zeros(10**6+1, dtype=np.int64)


def update(num):
    nums = np.arange(num, 10**6+1, num)
    is_divisible[nums] = True

counter = Counter(A)
ans = 0
for a, count in counter.items():
    if count == 1 and not is_divisible[a]:
        ans += 1
        
    update(a)

print(ans)

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


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


def divisor(n):
    div_list = set()
    limit = int(n**0.5) + 1
    for div in range(1, limit):
        if n % div == 0:
            div2 = n // div
            div_list.add(div)
            div_list.add(div2)
    
    return list(div_list)


        
A_dict = defaultdict(int)
for a in A:
    A_dict[a] += 1

    
ans = n
for a in A:
    A_dict[a] -= 1
    divs = divisor(a)
    for div in divs:
        if A_dict[div] >= 1:
            ans -= 1
            break
            
    A_dict[a] += 1


print(ans)

Fixed submission:
import numpy as np
from collections import Counter


n = int(input())
A = list(map(int, input().split()))
A.sort()
is_divisible = np.zeros(10**6+1, dtype=np.int64)


def update(num):
    nums = np.arange(num, 10**6+1, num)
    is_divisible[nums] = True

counter = Counter(A)
ans = 0
for a, count in counter.items():
    if count == 1 and not is_divisible[a]:
        ans += 1
        
    update(a)

print(ans)

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


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


def divisor(n):
    div_list = set()
    limit = int(n**0.5) + 1
    for div in range(1, limit):
        if n % div == 0:
            div2 = n // div
            div_list.add(div)
            div_list.add(div2)
    
    return list(div_list)


        
A_dict = defaultdict(int)
for a in A:
    A_dict[a] += 1

    
ans = n
for a in A:
    A_dict[a] -= 1
    divs = divisor(a)
    for div in divs:
        if A_dict[div] >= 1:
            ans -= 1
            break
            
    A_dict[a] += 1


print(ans)

Fixed submission:
import numpy as np
from collections import Counter


n = int(input())
A = list(map(int, input().split()))
A.sort()
is_divisible = np.zeros(10**6+1, dtype=np.int64)


def update(num):
    nums = np.arange(num, 10**6+1, num)
    is_divisible[nums] = True

counter = Counter(A)
ans = 0
for a, count in counter.items():
    if count == 1 and not is_divisible[a]:
        ans += 1
        
    update(a)

print(ans)