Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = [True] * n
c = Counter(a)
for i in range(n):
    if b[i]:
        for j in range(i+1, n):
            if a[j] % a[i] == 0 and i != j:
                b[j] = False
ans = 0
for i in range(n):
    if b[i] and c[a[i]] == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
b = [True] * n
c = Counter(a)
for i in range(n):
    if b[i]:
        for j in range(n):
            if a[j] % a[i] == 0 and i != j:
                b[j] = False
ans = 0
for i in range(n):
    if b[i] and c[a[i]] == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
b = [True] * n
c = Counter(a)
for i in range(n):
    if b[i]:
        for j in range(n):
            if a[j] % a[i] == 0 and i != j:
                b[j] = False
ans = 0
for i in range(n):
    if b[i] and c[a[i]] == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
a = list(map(int, input().split()))
b = sorted(a)
c = 0
for i in b:
    if b.count(i) != 1:
        c += 1
    else:
        for f in b[:b.index(i)]:
            if i % f == 0:
                c += 1
                break
print(num - c)        

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

num = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
  for f in make_divisors(i):
    if f in a:
      if f == i and a.count(f) > 1:
        b += 1
        break
      elif f != i:
        b += 1
        break
print(num - b)     


Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

num = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
  for f in make_divisors(i):
    if f in a:
      if f == i and a.count(f) > 1:
        b += 1
        break
      elif f != i:
        b += 1
        break
print(num - b)     

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import sympy

num = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
  for f in sympy.divisors(i)[:-1]:
    if f in a:
      b += 1
      break
print(num - b)  

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import sympy

num = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
  for f in sympy.divisors(i)[:-1]:
    if f in a:
      b += 1
      break
print(num - b)      

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0] * a[-1]
c = Counter(a)
for i in a:
    for j in range(i, a[-1]+1, i):
        dp[j-1] += 1
ans = 0
for i in a:
    if dp[i-1] == 1 and c[i]:
        ans += 1
print(ans)