Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)

A_div = [0 for _ in range(N)]
answer = 0
for i in range(N):
    if A_div[i] == 0:
        for j in range(i + 1, N):
            if A[i] % A[j] == 0:
                A_div[i] += 1
            if A[j] % A[i] == 0:
                A_div[j] += 1
    
    if A_div[i] == 0:
        answer += 1

print(answer)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A_div = [0] * (10 ** 6 + 1)

for a in A:
    A_div[a] += 1
    if A_div[a] == 1:
        for j in range(2 * a, 10 ** 6 + 1, a):
            A_div[j] += 100

print(A_div.count(1))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse = True)

answer = N
A_div = [0 for _ in range(N)]
for i in range(N):
    for j in range(i + 1, N):
        if A[i] % A[j] == 0:
            answer -= 1
            break

if A[-1] % A[-2] == 0:
    print(answer - 1)
else:
    print(answer)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A_div = [0] * (10 ** 6 + 1)

for a in A:
    A_div[a] += 1
    if A_div[a] == 1:
        for j in range(2 * a, 10 ** 6 + 1, a):
            A_div[j] += 100

print(A_div.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)

A_div = [0 for _ in range(N)]
for i in range(N):
    if A_div[i] == 0:
        for j in range(i + 1, N):
            if A[i] % A[j] == 0:
                A_div[i] += 1
            if A[j] % A[i] == 0:
                A_div[j] += 1

print(A_div.count(0))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A_div = [0] * (10 ** 6 + 1)

for a in A:
    A_div[a] += 1
    if A_div[a] == 1:
        for j in range(2 * a, 10 ** 6 + 1, a):
            A_div[j] += 100

print(A_div.count(1))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = list(set(sorted(A)))

A_div = [0 for _ in range(N)]
if len(A) == 1:
    print(0)
else:
    for i in range(N):
        if A_div[i] == 0:
            for j in range(i + 1, N):
                if A[i] % A[j] == 0:
                    A_div[i] += 1
                if A[j] % A[i] == 0:
                    A_div[j] += 1

    print(A_div.count(0))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A_div = [0] * (10 ** 6 + 1)

for a in A:
    A_div[a] += 1
    if A_div[a] == 1:
        for j in range(2 * a, 10 ** 6 + 1, a):
            A_div[j] += 100

print(A_div.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)

A_div = [0 for _ in range(N)]
for i in range(N):
    if A_div[i] == 0:
        for j in range(i + 1, N):
            if A[i] % A[j] == 0:
                A_div[i] += 1
            if A[j] % A[i] == 0:
                A_div[j] += 1

print(A_div.count(0))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A_div = [0] * (10 ** 6 + 1)

for a in A:
    A_div[a] += 1
    if A_div[a] == 1:
        for j in range(2 * a, 10 ** 6 + 1, a):
            A_div[j] += 100

print(A_div.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A_div = [0 for _ in range(N)]
answer = 0
for i in range(N):
    for j in range(i + 1, N):
        if A[i] % A[j] == 0:
            A_div[i] += 1
        if A[j] % A[i] == 0:
            A_div[j] += 1

print(A_div.count(0))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A_div = [0] * (10 ** 6 + 1)

for a in A:
    A_div[a] += 1
    if A_div[a] == 1:
        for j in range(2 * a, 10 ** 6 + 1, a):
            A_div[j] += 100

print(A_div.count(1))