Buggy python submission (verdict: Runtime Error):

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

a.sort()

max_a = a[-1]
is_available = [True] * (max_a + 1)

ans = 0

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and is_available[x]:
        ans += 1
    for b in range(x, m + 1, x):
        is_available[b] = False

if is_available[a[-1]]:
    ans += 1

print(ans)

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())

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

a.sort()

dp = [True] * a[-1]

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n = int(input())

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

a.sort()

dp = [True] * n

for i in range(len(a) - 1):
    if dp[i] == True:
        for j in range(1, n - i):
            if dp[i + j] == True:
                if a[i + j] % a[i] == 0:
                    dp[i + j] = False
        
        if a[i] == a[i + 1]:
            dp[i] = False

print(sum(dp))

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

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

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

a.sort()

dp = [True] * n

for i in range(len(a) - 1):
    if dp[i] == True:
        for j in range(1, n - i):
            if dp[i + j] == True:
                if a[i + j] % a[i] == 0:
                    dp[i + j] = False
        
        if a[i] == a[i + 1]:
            dp[i] = False

print(sum(dp))

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

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

n = int(input())

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

a.sort()

dp = [True] * n

for i in range(len(a) - 1):
    if dp[i] == True:
        for j, x in enumerate(a[i+1:], 1):
            if dp[i + j] == True:
                if a[i + j] % a[i] == 0:
                    dp[i + j] = False
        
        if a[i] == a[i + 1]:
            dp[i] = False

print(sum(dp))

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

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

n = int(input())

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

a.sort()

dp = [True] * n

for i in range(len(a)):
    if dp[i] == True:
        for j, x in enumerate(a[i+1:], 1):
            if dp[i + j] == True:
                if a[i + j] % a[i] == 0:
                    dp[i + j] = False

num_dict = dict(collections.Counter(a))

result = [x for x, y in zip(a, dp) if (y == True) and (num_dict[x] == 1)]

print(len(result))

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

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

n = int(input())

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

a.sort()

for i in range(len(a)):
    if dp[i] == True:
        for j, x in enumerate(a[i+1:], 1):
            if dp[i + j] == True:
                if a[i + j] % a[i] == 0:
                    dp[i + j] = False

num_dict = dict(collections.Counter(a))

result = [x for x, y in zip(a, dp) if (y == True) and (num_dict[x] == 1)]

print(len(result))


Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

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

n = int(input())

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

a.sort()

if a[0] != 1:
    i = 0

    while i < len(a):
        a = [x for x in a if (not float.is_integer(x / a[i])) or ((x / a[i]) == 1)]

        i += 1

    num_dict = dict(collections.Counter(a))

    counts = num_dict.values()

    temp = dict(collections.Counter(counts))

    print(temp.get(1, 0))

elif (len(a) > 1) and (a[0] == a[1]):
    print(0)
else:
    print(1)

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

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

n = int(input())

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

a.sort()

temp = a[-1] / 2

if a[0] != 1:
    a = np.array(a)

    i = 0

    while i < len(a):
        b = a / a[i]

        a = a[(b != b.astype(int)) | (b == 1)]

        i += 1

        if a[i] > temp:
            break

    u, counts = np.unique(a, return_counts=True)

    print(sum(counts == 1))

elif (len(a) > 1) and (a[0] == a[1]):
    print(0)
else:
    print(1)

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

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

n = int(input())

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

a.sort()

temp = np.sqrt(a[-1])

if a[0] != 1:
    a = np.array(a)

    i = 0

    while i < len(a):
        b = a / a[i]

        a = a[(b != b.astype(int)) | (b == 1)]

        i += 1

        if a[i] > temp:
            break

    u, counts = np.unique(a, return_counts=True)

    print(sum(counts == 1))

elif (len(a) > 1) and (a[0] == a[1]):
    print(0)
else:
    print(1)

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)

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

n = int(input())

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

a.sort()

if a[0] != 1:
    a = np.array(a)

    i = 0

    while i < len(a):
        b = a / a[i]

        a = a[(b != b.astype(int)) | (b == 1)]

        i += 1

    u, counts = np.unique(a, return_counts=True)

    print(sum(counts == 1))

elif (len(a) > 1) and (a[0] == a[1]):
    print(0)
else:
    print(1)

Fixed submission:
n = int(input())

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

a.sort()

dp = [True] * (a[-1] + 1)

ans = 0

m = a[-1]

for i, x in enumerate(a[:-1]):
    if not a[i+1] == x and dp[x]:
        ans += 1
    for b in range(x, m + 1, x):
        dp[b] = False

if dp[a[-1]]:
    ans += 1

print(ans)