Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import Counter


n = int(input())
a = [int(x) for x in input().split(' ')]

s = np.array(sorted(set(a)),int)
bl = np.array([True]*len(s), bool)
for i in range(1, len(s)):
    mod = s[i]
    buf = s[:i][bl[:i]]
    for j in range(len(buf)):
        if mod % buf[j] == 0:
            bl[i] = False
            break
s = set(s[bl])

c = Counter(a)
keys = set([k for k, v in c.items() if v == 1])

print(len(s&keys))

Fixed submission:
n = int(input())
a = [int(x) for x in input().split(' ')]

a.sort()
a_max = a[-1] + 1   # aの最大値
lst = [0] * a_max   # a_max個のリストを生成

for x in a:
    lst[x] += 1                         # リストの該当の数字に1追加 
    if lst[x] == 1:                     # まだ他の数値の倍数でなければ、リストへ2倍、3倍…の数字を1追加していく
        for i in range(x*2, a_max, x):
            lst[i] += 1

output = 0
for x in a:
    if lst[x] == 1:
        output += 1
print(output)

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


n = int(input())
a = [int(x) for x in input().split(' ')]

s = np.array(sorted(set(a)),int)
bl = np.array([True]*n, bool)
for i in range(1, n):
    mod = s[i]
    buf = s[:i][bl[:i]]
    for j in range(len(buf)):
        if mod % buf[j] == 0:
            bl[i] = False
            break
s = set(s[bl])

c = Counter(a)
keys = set([k for k, v in c.items() if v == 1])

print(len(s&keys))

Fixed submission:
n = int(input())
a = [int(x) for x in input().split(' ')]

a.sort()
a_max = a[-1] + 1   # aの最大値
lst = [0] * a_max   # a_max個のリストを生成

for x in a:
    lst[x] += 1                         # リストの該当の数字に1追加 
    if lst[x] == 1:                     # まだ他の数値の倍数でなければ、リストへ2倍、3倍…の数字を1追加していく
        for i in range(x*2, a_max, x):
            lst[i] += 1

output = 0
for x in a:
    if lst[x] == 1:
        output += 1
print(output)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import Counter


n = int(input())
a = [int(x) for x in input().split(' ')]

s = np.array(sorted(set(a)),int)
i = 1
while i < len(s)-1:
    s = np.concatenate([s[:i], s[i:][s[i:]%s[i-1]!=0]],0)
    i += 1
s = set(s)

c = Counter(a)
keys = set([k for k, v in c.items() if v == 1])

print(len(s&keys))

Fixed submission:
n = int(input())
a = [int(x) for x in input().split(' ')]

a.sort()
a_max = a[-1] + 1   # aの最大値
lst = [0] * a_max   # a_max個のリストを生成

for x in a:
    lst[x] += 1                         # リストの該当の数字に1追加 
    if lst[x] == 1:                     # まだ他の数値の倍数でなければ、リストへ2倍、3倍…の数字を1追加していく
        for i in range(x*2, a_max, x):
            lst[i] += 1

output = 0
for x in a:
    if lst[x] == 1:
        output += 1
print(output)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split(' ')]

s = sorted(set(a))
i = 0
while i < len(s):
    l = len(s)
    for j in range(l-1, i, -1):
        if s[j] % s[i] == 0:
            s.pop(j)
    i += 1
s = set(s)

from collections import Counter
c = Counter(a)
keys = set([k for k, v in c.items() if v == 1])

print(len(s&keys))

Fixed submission:
n = int(input())
a = [int(x) for x in input().split(' ')]

a.sort()
a_max = a[-1] + 1   # aの最大値
lst = [0] * a_max   # a_max個のリストを生成

for x in a:
    lst[x] += 1                         # リストの該当の数字に1追加 
    if lst[x] == 1:                     # まだ他の数値の倍数でなければ、リストへ2倍、3倍…の数字を1追加していく
        for i in range(x*2, a_max, x):
            lst[i] += 1

output = 0
for x in a:
    if lst[x] == 1:
        output += 1
print(output)