Buggy python submission (verdict: Runtime Error):
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        if p[tmp] == 1:
            continue
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 10)
    c = Counter(A)

    for a in A:
        tmp = a * 2
        if p[tmp] == 1:
            continue
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in A:
        tmp = a * 2
        if p[tmp] == 1:
            continue
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 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()

    ans = 0
    modlist = list()
    ignor = list()
    for i in range(N):
        flag = True
        for j, m in enumerate(modlist):
            if A[i] in ignor:
                flag = False
                break
            if m == A[i]:
                ignor.append(A[i])
                ans -= 1
                flag = False
                break

            if A[i] % m == 0:
                flag = False
                break
        if flag:
            modlist.append(A[i])
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 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()

    ans = 0
    modlist = list()
    ignor = list()
    for i in range(N):
        flag = True
        for j, m in enumerate(modlist):
            if A[i] in ignor:
                flag = False
                break
            if m == A[i]:
                ignor.append(A[i])
                ans -= 1
                flag = False
                break

            if A[i] % m == 0:
                flag = False
                break
        if flag:
            modlist.append(A[i])
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
from math import sqrt
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()