Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = tuple(map(int, input().split()))

    ans = 0
    for i in range(len(a)):
        if a.count(a[i]) > 1:
            continue
        divisors = set()
        for j in range(1, int(a[i] ** 0.5) + 1):
            if a[i] % j == 0:
                divisors.add(j)
                if j != a[i] // j:
                    divisors.add(a[i] // j)
        if len(set(a) & divisors) == 1:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a = tuple(map(int, input().split()))

    ans = 0
    mx = max(a) + 1
    dp = [0] * mx
    for i in a:
        for j in range(i, mx, i):
            dp[j] += 1
    for i in a:
        if dp[i] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    a = tuple(a)

    ans = [0] * n
    for i in range(len(a) - 1):
        if ans[i] == 1:
            continue
        for j in range(i + 1, len(a)):
            if a[i] == a[j]:
                ans[i] = 1
                ans[j] = 1
            else:
                if a[j] % a[i] == 0:
                    ans[j] = 1
    print(n - sum(ans))


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a = tuple(map(int, input().split()))

    ans = 0
    mx = max(a) + 1
    dp = [0] * mx
    for i in a:
        for j in range(i, mx, i):
            dp[j] += 1
    for i in a:
        if dp[i] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = sorted(tuple(map(int, input().split())))

    ans = [0] * n
    for i in range(len(a) - 1):
        if ans[i] == 1:
            continue
        for j in range(i + 1, len(a)):
            if a[i] == a[j]:
                ans[i] = 1
                ans[j] = 1
            else:
                if a[j] % a[i] == 0:
                    ans[j] = 1
    print(n - sum(ans))


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a = tuple(map(int, input().split()))

    ans = 0
    mx = max(a) + 1
    dp = [0] * mx
    for i in a:
        for j in range(i, mx, i):
            dp[j] += 1
    for i in a:
        if dp[i] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(list(map(int, input().split())))

ans = [0] * n
for i in range(len(a) - 1):
    if ans[i] == 1:
        continue
    for j in range(i + 1, len(a)):
        if a[i] % a[j] == 0:
            ans[i] = 1
        if a[j] % a[i] == 0:
            ans[j] = 1
print(n - sum(ans))

Fixed submission:
def main():
    n = int(input())
    a = tuple(map(int, input().split()))

    ans = 0
    mx = max(a) + 1
    dp = [0] * mx
    for i in a:
        for j in range(i, mx, i):
            dp[j] += 1
    for i in a:
        if dp[i] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))

ans = 0
for i in a:
    if np.count_nonzero(i % a == 0) == 1:
        ans += 1
print(ans)

Fixed submission:
def main():
    n = int(input())
    a = tuple(map(int, input().split()))

    ans = 0
    mx = max(a) + 1
    dp = [0] * mx
    for i in a:
        for j in range(i, mx, i):
            dp[j] += 1
    for i in a:
        if dp[i] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()