Buggy python submission (verdict: Runtime Error):

    n = int(input())
    A = list(map(int, input().split()))
    max_a = max(A)
    m = set()
    checked = set()
    duplicated = set()

    for a in A:
        if a in checked:
            duplicated.add(a)
            continue

        i = 2
        while a*i <= max_a:
            m.add(a*i)
            i += 1

        checked.add(a)

    ans = 0
    for a in A:
        if a in duplicated: continue

        if a not in m:
            ans += 1
    
    print(ans)
 
resolve()

Fixed submission:
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    max_a = max(A)
    m = set()
    checked = set()
    duplicated = set()

    for a in A:
        if a in checked:
            duplicated.add(a)
            continue

        i = 2
        while a*i <= max_a:
            m.add(a*i)
            i += 1

        checked.add(a)

    ans = 0
    for a in A:
        if a in duplicated: continue

        if a not in m:
            ans += 1
    
    print(ans)
 
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    uni = sorted(list(set(A)))
    dup = [x for x in set(A) if A.count(x) > 1]
    m = set()

    ans = 0

    for a in uni:
        if a in m: continue

        i = 0
        a_max = uni[len(uni)-1]

        while True:
            m.add(a * i)
            if a*i < a_max:
                i += 1
            else:
                break
        
        if a not in dup:
            ans += 1
 
    print(ans)
 
resolve()

Fixed submission:
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    max_a = max(A)
    m = set()
    checked = set()
    duplicated = set()

    for a in A:
        if a in checked:
            duplicated.add(a)
            continue

        i = 2
        while a*i <= max_a:
            m.add(a*i)
            i += 1

        checked.add(a)

    ans = 0
    for a in A:
        if a in duplicated: continue

        if a not in m:
            ans += 1
    
    print(ans)
 
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    uni = sorted(list(set(a)))
    dup = [x for x in set(a) if a.count(x) > 1]

    ans = 0
    for i in range(len(uni)):
        if uni[i] in dup:
            continue

        for j in range(len(uni)):
            if i == j: continue
            
            if uni[i] % uni[j] == 0:
                break
        else:
            ans += 1
 
    print(ans)
 
resolve()

Fixed submission:
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    max_a = max(A)
    m = set()
    checked = set()
    duplicated = set()

    for a in A:
        if a in checked:
            duplicated.add(a)
            continue

        i = 2
        while a*i <= max_a:
            m.add(a*i)
            i += 1

        checked.add(a)

    ans = 0
    for a in A:
        if a in duplicated: continue

        if a not in m:
            ans += 1
    
    print(ans)
 
resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    a = list(set(a))
    a.sort()

    if len(a) < 2:
        print(0)
        return

    ans = 0
    for i in range(n):
        for j in range(min(i+1,n)):
            if i == j: continue
            
            if a[i] % a[j] == 0:
                break
        else:
            ans += 1

    print(ans)

resolve()

Fixed submission:
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    max_a = max(A)
    m = set()
    checked = set()
    duplicated = set()

    for a in A:
        if a in checked:
            duplicated.add(a)
            continue

        i = 2
        while a*i <= max_a:
            m.add(a*i)
            i += 1

        checked.add(a)

    ans = 0
    for a in A:
        if a in duplicated: continue

        if a not in m:
            ans += 1
    
    print(ans)
 
resolve()

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

    ans = 0
    for i in range(n):
        for j in range(n):
            if i == j: continue
            
            if a[i] % a[j] == 0:
                break
        else:
            ans += 1

    print(ans)

resolve()

Fixed submission:
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    max_a = max(A)
    m = set()
    checked = set()
    duplicated = set()

    for a in A:
        if a in checked:
            duplicated.add(a)
            continue

        i = 2
        while a*i <= max_a:
            m.add(a*i)
            i += 1

        checked.add(a)

    ans = 0
    for a in A:
        if a in duplicated: continue

        if a not in m:
            ans += 1
    
    print(ans)
 
resolve()