Buggy python submission (verdict: Runtime Error):
# ABC170

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

a.sort()
a_max = max(a)
dp = [True for _ in range(a_max+1)]

ans = 0
for i in range(n):
    if dp[a[i]]:
        for j in range(0, a_max+1, a[i]):
            dp[j] = False
        if (a[i] != a[i-1]) and (a[i] != a[i+1]):
            ans += 1

print(ans)


Fixed submission:
# ABC170

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

a.sort()
a_max = max(a)
dp = [True for _ in range(a_max+1)]

ans = 0
for i in range(n):
    if dp[a[i]]:
        for j in range(0, a_max+1, a[i]):
            dp[j] = False
        if i > 0:
            if a[i] == a[i-1]:
                continue
        if i < n-1:
            if a[i] == a[i+1]:
                continue
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# ABC170

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

a.sort()
maxa = max(a)
dp = [True for _ in range(maxa+1)]

ans = 0
for ai in a:
    if dp[ai]:
        for i in range(0, maxa+1, ai):
            dp[i] = False
        if a.count(ai) == 1:
            ans += 1

print(ans)


Fixed submission:
# ABC170

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

a.sort()
a_max = max(a)
dp = [True for _ in range(a_max+1)]

ans = 0
for i in range(n):
    if dp[a[i]]:
        for j in range(0, a_max+1, a[i]):
            dp[j] = False
        if i > 0:
            if a[i] == a[i-1]:
                continue
        if i < n-1:
            if a[i] == a[i+1]:
                continue
        ans += 1

print(ans)

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

a.sort()

ans = n
divisibles = [False for i in range(n)]
for i in range(n):
    divisible = False
    for j in range(n):
        if i == j:
            continue
        elif divisibles[i]:
            continue
        elif a[i] < a[j]:
            break
        elif a[i] % a[j] == 0:
            ans -= 1
            divisibles[i] = True
            break

print(ans)


Fixed submission:
# ABC170

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

a.sort()
a_max = max(a)
dp = [True for _ in range(a_max+1)]

ans = 0
for i in range(n):
    if dp[a[i]]:
        for j in range(0, a_max+1, a[i]):
            dp[j] = False
        if i > 0:
            if a[i] == a[i-1]:
                continue
        if i < n-1:
            if a[i] == a[i+1]:
                continue
        ans += 1

print(ans)

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

a.sort()

ans = n
divisibles = [False for i in range(n)]
for i in range(n):
    divisible = False
    for j in range(n):
        if i == j:
            continue
        elif a[i] < a[j]:
            break
        elif a[i] % a[j] == 0:
            ans -= 1
            divisibles[i] = True
            break

print(ans)


Fixed submission:
# ABC170

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

a.sort()
a_max = max(a)
dp = [True for _ in range(a_max+1)]

ans = 0
for i in range(n):
    if dp[a[i]]:
        for j in range(0, a_max+1, a[i]):
            dp[j] = False
        if i > 0:
            if a[i] == a[i-1]:
                continue
        if i < n-1:
            if a[i] == a[i+1]:
                continue
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(stdins) for stdins in input().split()]

a.sort()

ans = n
divisibles = []
for i in range(n):
    divisible = False
    for j in range(n):
        if i == j:
            continue
        elif a[i] < a[j]:
            break
        elif divisibles[j]:
            continue
        elif a[i] % a[j] == 0:
            ans -= 1
            divisible = True
            break
    divisibles.append(divisible)

print(ans)


Fixed submission:
# ABC170

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

a.sort()
a_max = max(a)
dp = [True for _ in range(a_max+1)]

ans = 0
for i in range(n):
    if dp[a[i]]:
        for j in range(0, a_max+1, a[i]):
            dp[j] = False
        if i > 0:
            if a[i] == a[i-1]:
                continue
        if i < n-1:
            if a[i] == a[i+1]:
                continue
        ans += 1

print(ans)

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

a.sort()

ans = n
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        elif a[i] < a[j]:
            break
        elif a[i] % a[j] == 0:
            ans -= 1
            break

print(ans)


Fixed submission:
# ABC170

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

a.sort()
a_max = max(a)
dp = [True for _ in range(a_max+1)]

ans = 0
for i in range(n):
    if dp[a[i]]:
        for j in range(0, a_max+1, a[i]):
            dp[j] = False
        if i > 0:
            if a[i] == a[i-1]:
                continue
        if i < n-1:
            if a[i] == a[i+1]:
                continue
        ans += 1

print(ans)

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

a.sort()

ans = n
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        elif a[i] % a[j] == 0:
            ans -= 1
            break

print(ans)


Fixed submission:
# ABC170

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

a.sort()
a_max = max(a)
dp = [True for _ in range(a_max+1)]

ans = 0
for i in range(n):
    if dp[a[i]]:
        for j in range(0, a_max+1, a[i]):
            dp[j] = False
        if i > 0:
            if a[i] == a[i-1]:
                continue
        if i < n-1:
            if a[i] == a[i+1]:
                continue
        ans += 1

print(ans)