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

b = [True for i in range(n)]

for i, j in enumerate(a):
    if i < n-1 and b[i]:
        for k in range(i+1, n):
            if b[k] and a[k] % j == 0:
                b[k] = False
        if a[i] == a[i+1]:
            b[i] = False

print(b.count(True))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()

b = [True for i in range(a[-1]+1)]

ans = 0

for i, j in enumerate(a):
    if b[j]:
        t = 1
        while j*t < len(b):
            b[j*t] = False
            t += 1
        
        if i == n-1:
            ans += 1
        elif j != a[i+1]:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())

a = list(map(int, input().split()))
a.sort()
a = deque(a)

ans = []
double = []

s = 0
while len(a) > 0:
    ans.append(a.popleft())
    if len(a) > 0 and ans[s] == a[0]:
        double.append(ans[s])
    a = deque([i for i in a if i % ans[s] != 0])
    s += 1

for k in double:
    if k in ans:
        ans.remove(k)
print(len(ans))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()

b = [True for i in range(a[-1]+1)]

ans = 0

for i, j in enumerate(a):
    if b[j]:
        t = 1
        while j*t < len(b):
            b[j*t] = False
            t += 1
        
        if i == n-1:
            ans += 1
        elif j != a[i+1]:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())

a = list(map(int, input().split()))
a.sort()
a = deque(a)

ans = []
double = []

s = 0
while len(a) > 0:
    ans.append(a.popleft())
    if ans[s] in a:
        double.append(ans[s])
    a = deque([i for i in a if i % ans[s] != 0])
    s += 1

for k in double:
    if k in ans:
        ans.remove(k)
print(len(ans))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()

b = [True for i in range(a[-1]+1)]

ans = 0

for i, j in enumerate(a):
    if b[j]:
        t = 1
        while j*t < len(b):
            b[j*t] = False
            t += 1
        
        if i == n-1:
            ans += 1
        elif j != a[i+1]:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = list(map(int, input().split()))
a.sort()

ans = [a[0]]
double = []

for i in range(1, n):
    flag = True
    for j in ans:
        if a[i] == j:
            double.append(j)
            flag = False
            break
        if a[i] % j == 0:
            flag = False
            break
    if flag:
        ans.append(a[i])

for k in double:
    if k in ans:
        ans.remove(k)
print(len(ans))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()

b = [True for i in range(a[-1]+1)]

ans = 0

for i, j in enumerate(a):
    if b[j]:
        t = 1
        while j*t < len(b):
            b[j*t] = False
            t += 1
        
        if i == n-1:
            ans += 1
        elif j != a[i+1]:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = list(map(int, input().split()))
a.sort()

ans = [a[0]]
double = []

for i in range(1, n):
    flag = True
    for j in ans:
        if a[i] == j:
            double.append(j)
            flag = False
            break
        if a[i] % j == 0:
            flag = False
            break
    if flag:
        ans.append(a[i])

for k in double:
    if k in ans:
        ans.remove(k)
print(len(ans))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()

b = [True for i in range(a[-1]+1)]

ans = 0

for i, j in enumerate(a):
    if b[j]:
        t = 1
        while j*t < len(b):
            b[j*t] = False
            t += 1
        
        if i == n-1:
            ans += 1
        elif j != a[i+1]:
            ans += 1
        
print(ans)