Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    A.sort()

    B = [0] * (max(A) + 1)

    ans = 0
    for i, a in enumerate(A):
        if B[a] == 1:
            continue
        for aa in range(a, max(A) + 1, a):
            B[aa] = 1

        if i != len(A) - 1 and A[i] == A[i + 1]:
            continue

        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    A.sort()

    B = [False] * (max(A) + 1)

    ans = 0
    for i, a in enumerate(A):
        if B[a]:
            continue
        for aa in range(a, max(A) + 1, a):
            B[aa] = True

        if i != len(A) - 1 and A[i] == A[i + 1]:
            continue

        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    A.sort()

    B = [False] * (max(A) + 1)

    ans = 0
    for i, a in enumerate(A):
        if B[a]:
            continue
        for aa in range(a, max(A) + 1, a):
            B[aa] = True

        if i != len(A) - 1 and A[i] == A[i + 1]:
            continue

        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

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

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    past = set()
    ans = 0
    ansset = set()
    for a in aset:
        divs = make_divisors(a)
        for div in divs:
            if div in past:
                break
        else:
            ansset.add(a)
            ans += 1

        past.add(a)

    c = collections.Counter(A)
    for cc in c.most_common():
        if cc[1] == 1:
            break

        if cc[1] > 1 and cc[0] in ansset:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

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

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    past = set()
    ans = 0
    ansset = set()
    for a in aset:
        divs = make_divisors(a)
        for div in divs:
            if div in past:
                break
        else:
            ansset.add(a)
            ans += 1

        past.add(a)

    c = collections.Counter(A)
    for cc in c.most_common():
        if cc[1] == 1:
            break

        if cc[1] > 1 and cc[0] in ansset:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

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

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    past = set()
    ans = 0
    ansset = set()
    for a in aset:
        divs = sympy.divisors(a)
        for div in divs:
            if div in past:
                break
        else:
            ansset.add(a)
            ans += 1

        past.add(a)

    c = collections.Counter(A)
    for cc in c.most_common():
        if cc[1] == 1:
            break

        if cc[1] > 1 and cc[0] in ansset:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

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

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    past = set()
    ans = 0
    ansset = set()
    for a in aset:
        divs = make_divisors(a)
        for div in divs:
            if div in past:
                break
        else:
            ansset.add(a)
            ans += 1

        past.add(a)

    c = collections.Counter(A)
    for cc in c.most_common():
        if cc[1] == 1:
            break

        if cc[1] > 1 and cc[0] in ansset:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

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

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    past = set()
    ans = 0
    ansset = set()
    for a in aset:
        divs = make_divisors(a)
        for div in divs:
            if div in past:
                break
        else:
            ansset.add(a)
            ans += 1

        past.add(a)

    c = collections.Counter(A)
    for k in c.keys():
        if c[k] > 1 and k in ansset:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

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

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    past = set()
    ans = 0
    ansset = set()
    for a in aset:
        divs = make_divisors(a)
        for div in divs:
            if div in past:
                break
        else:
            ansset.add(a)
            ans += 1

        past.add(a)

    c = collections.Counter(A)
    for k in c.keys():
        if c[k] > 1 and k in ansset:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    A.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in A:
        for i in range(1, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    for a in A:
        if ans[a] == 0 or ans[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    ans = [0] * (10 ** 6 + 1)

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



if __name__ == '__main__':
    main()