Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    dp = [True for _ in range(max(A)+1)]
    for a in A:
        if counter[a] > 1:
            dp[a] = False
        for j in range(a+a, max(A)+1, a):
            dp[j] = False
    #print(dp)
    print(sum(1 for a in A if dp[a]))

if '__main__' == __name__:
    resolve()


Fixed submission:
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    maxA = max(A)
    dp = [True for _ in range(max(A)+1)]
    for a in A:
        if counter[a] > 1:
            dp[a] = False
        for j in range(a+a, maxA+1, a):
            dp[j] = False
    #print(dp)
    print(sum(1 for a in A if dp[a]))

if '__main__' == __name__:
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    dp = [True for _ in range(max(A)+1)]
    ans = 0
    for a in A:
        if dp[a]:
            for j in range(max(A)//a+1):
                dp[a*j] = False
            if counter[a] == 1:
                ans += 1
    print(ans)

if '__main__' == __name__:
    resolve()


Fixed submission:
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    maxA = max(A)
    dp = [True for _ in range(max(A)+1)]
    for a in A:
        if counter[a] > 1:
            dp[a] = False
        for j in range(a+a, maxA+1, a):
            dp[j] = False
    #print(dp)
    print(sum(1 for a in A if dp[a]))

if '__main__' == __name__:
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    dp = [True for _ in range(max(A)+1)]
    ans = 0
    for a in A:
        if dp[a]:
            for j in range(max(A)//a+1):
                dp[a*j] = False
            if counter[a] == 1:
                ans += 1
    print(ans)

if '__main__' == __name__:
    resolve()


Fixed submission:
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    maxA = max(A)
    dp = [True for _ in range(max(A)+1)]
    for a in A:
        if counter[a] > 1:
            dp[a] = False
        for j in range(a+a, maxA+1, a):
            dp[j] = False
    #print(dp)
    print(sum(1 for a in A if dp[a]))

if '__main__' == __name__:
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    dp = [True for _ in range(max(A)+1)]
    counts = [0 for _ in range(max(A)+1)]
    for a in A:
        counts[a] += 1
        if dp[a] and counts[a] == 1:
            for j in range(a*2, max(A)+1, a):
                dp[j] = False
    cnt = 0
    #print(dp)
    for a in A:
        if dp[a] and counts[a] == 1:
            cnt += 1
    print(cnt)

if '__main__' == __name__:
    resolve()

Fixed submission:
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    maxA = max(A)
    dp = [True for _ in range(max(A)+1)]
    for a in A:
        if counter[a] > 1:
            dp[a] = False
        for j in range(a+a, maxA+1, a):
            dp[j] = False
    #print(dp)
    print(sum(1 for a in A if dp[a]))

if '__main__' == __name__:
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    dp = [True for _ in range(max(A)+1)]
    counts = [0 for _ in range(max(A)+1)]
    for a in A:
        if dp[a]:
            counts[a] += 1
            i = 2
            v = a * i
            while v <= max(A):
                dp[v] = False
                i += 1
                v = a * i
    cnt = 0
    for a in A:
        if dp[a] and counts[a] == 1:
            cnt += 1
    print(cnt)

if '__main__' == __name__:
    resolve()

Fixed submission:
def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    maxA = max(A)
    dp = [True for _ in range(max(A)+1)]
    for a in A:
        if counter[a] > 1:
            dp[a] = False
        for j in range(a+a, maxA+1, a):
            dp[j] = False
    #print(dp)
    print(sum(1 for a in A if dp[a]))

if '__main__' == __name__:
    resolve()