Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n):
    if p[a[k]-1]:
        if a[k] != a[k+1] or k == n-1:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1        
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n-1):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1    
k = n-1
if p[a[k]-1]:
    for i in range(1,a[-1]+1):
        if a[k]*i <= a[-1]:
            p[a[k]*i-1] = False
        else:
            break
else:
        ans -= 1   
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1        

    

print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n-1):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1    
k = n-1
if p[a[k]-1]:
    for i in range(1,a[-1]+1):
        if a[k]*i <= a[-1]:
            p[a[k]*i-1] = False
        else:
            break
else:
        ans -= 1   
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1        

    

print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n-1):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1    
k = n-1
if p[a[k]-1]:
    for i in range(1,a[-1]+1):
        if a[k]*i <= a[-1]:
            p[a[k]*i-1] = False
        else:
            break
else:
        ans -= 1   
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [a[0]]
for i in range(1,n):
    v = 1
    for j in range(len(p)):
        if a[i] % a[j] == 0:
            v = 0
            break
    if v == 1:
        p.append(a[i])
ans = len(p)
for i in range(n-2):
    if a[i] == a[i+1] and a[i+1] != a[i+2]:
        ans -= 1
if a[-1] == a[-2]:
    ans -= 1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n-1):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1    
k = n-1
if p[a[k]-1]:
    for i in range(1,a[-1]+1):
        if a[k]*i <= a[-1]:
            p[a[k]*i-1] = False
        else:
            break
else:
        ans -= 1   
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum
p = seachPrimeNum(1000)
def factorization(n):
    arr = []
    temp = n
    for i in p:
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
for i in range(n-2):
    if a[i] == a[i+1] and a[i+1] != a[i+2]:
        ans -= 1
if a[-1] == a[-2]:
    ans -= 1
for i in range(n):
    a[i] = factorization(a[i])
import collections
d = collections.defaultdict(int)
for i in range(n):
    for j in range(len(a[i])):
        if a[i][j][0] in d:
            break
        ans += 1
        d[a[i][j][0]] = 1
if a[0] == [[1,1]]:
    print(0)
else:
    print(ans)



Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n-1):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1    
k = n-1
if p[a[k]-1]:
    for i in range(1,a[-1]+1):
        if a[k]*i <= a[-1]:
            p[a[k]*i-1] = False
        else:
            break
else:
        ans -= 1   
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum
p = seachPrimeNum(1000)
def factorization(n):
    arr = []
    temp = n
    for i in p:
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
for i in range(n-2):
    if a[i] == a[i+1] and a[i+1] != a[i+2]:
        ans -= 1
if a[-1] == a[-2]:
    ans -= 1
for i in range(n):
    a[i] = factorization(a[i])
import collections
d = collections.defaultdict(int)
for i in range(n):
    for j in range(len(a[i])):
        if a[i][j][0] in d:
            break
        ans += 1
        d[a[i][j][0]] = 1
if a[0] == [[1,1]]:
    print(0)
else:
    print(ans)



Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n-1):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1    
k = n-1
if p[a[k]-1]:
    for i in range(1,a[-1]+1):
        if a[k]*i <= a[-1]:
            p[a[k]*i-1] = False
        else:
            break
else:
        ans -= 1   
print(ans)