Buggy python submission (verdict: Time Limit Exceeded):
import sys
# from sympy import divisors
from collections import Counter


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a_list = list(map(int, input().split()))
    # キーに要素、値に出現回数を持つカウンタ
    a_counter = Counter(a_list)
    ans = 0
    for a in a_list:
        # aの約数の集合
        divs = make_divisors(a)
        for divisor in divs:
            if a_counter[divisor] > 0:
                if divisor == a and a_counter[divisor] == 1:
                    continue
                break
        else:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
from collections import Counter


def main():
    input = sys.stdin.buffer.readline
    _ = input()
    a_list = list(map(int, input().split()))
    res_set = set(a_list)
    # キーに要素、値に出現回数を持つカウンタ
    a_counter = Counter(a_list)
    for e in a_counter.items():  # e:(整数，出現回数)
        if e[1] == 1:
            for i in range(e[0] * 2, 10**6 + 1, e[0]):  # その整数を含まない倍数
                res_set.discard(i)
        else:
            for i in range(e[0], 2 * 10**6 + 1, e[0]):  # その整数を含む倍数
                res_set.discard(i)
    print(len(res_set))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
# from sympy import divisors
from collections import Counter


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a_list = list(map(int, input().split()))
    # キーに要素、値に出現回数を持つカウンタ
    a_counter = Counter(a_list)
    ans = 0
    for a in a_list:
        # aの約数の集合
        divs = make_divisors(a)
        for divisor in divs:
            if a_counter[divisor] > 0:
                if divisor == a and a_counter[divisor] == 1:
                    continue
                break
        else:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
from collections import Counter


def main():
    input = sys.stdin.buffer.readline
    _ = input()
    a_list = list(map(int, input().split()))
    res_set = set(a_list)
    # キーに要素、値に出現回数を持つカウンタ
    a_counter = Counter(a_list)
    for e in a_counter.items():  # e:(整数，出現回数)
        if e[1] == 1:
            for i in range(e[0] * 2, 10**6 + 1, e[0]):  # その整数を含まない倍数
                res_set.discard(i)
        else:
            for i in range(e[0], 2 * 10**6 + 1, e[0]):  # その整数を含む倍数
                res_set.discard(i)
    print(len(res_set))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
from sympy import divisors
from collections import Counter


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a_list = list(map(int, input().split()))
    # キーに要素、値に出現回数を持つカウンタ
    a_counter = Counter(a_list)
    ans = 0
    for a in a_list:
        # aの約数の集合
        divs = divisors(a)
        for divisor in divs:
            if a_counter[divisor] > 0:
                if divisor == a and a_counter[divisor] == 1:
                    continue
                break
        else:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
from collections import Counter


def main():
    input = sys.stdin.buffer.readline
    _ = input()
    a_list = list(map(int, input().split()))
    res_set = set(a_list)
    # キーに要素、値に出現回数を持つカウンタ
    a_counter = Counter(a_list)
    for e in a_counter.items():  # e:(整数，出現回数)
        if e[1] == 1:
            for i in range(e[0] * 2, 10**6 + 1, e[0]):  # その整数を含まない倍数
                res_set.discard(i)
        else:
            for i in range(e[0], 2 * 10**6 + 1, e[0]):  # その整数を含む倍数
                res_set.discard(i)
    print(len(res_set))


if __name__ == '__main__':
    main()