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

if N == 1:
  print(1)
  exit()

flag = [0]*(10**6+5)
for i in range(N):
  flag[A[i]] = 1

for i in range(N):
  if flag[A[i]] == 0:
    continue
  if i>0 and A[i]==A[i-1]:
    flag[A[i]] = 0
    continue
  for num in range(A[i]*2,A[-1]+A[i],A[i]):
    flag[num] = 0
  
print(sum(flag))

Fixed submission:
N = int(input())
*A,=map(int,input().split())
A = sorted(A)

if N == 1:
  print(1)
  exit()

flag = [0]*(10**6+5)
for i in range(N):
  flag[A[i]] = 1

for i in range(N):
  if flag[A[i]] == 0:
    continue
  if i>0 and A[i]==A[i-1]:
    flag[A[i]] = 0
    continue
  for num in range(A[i]*2,A[-1]+1,A[i]):
    flag[num] = 0
  
print(sum(flag))

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

if N == 1:
  print(1)
  exit()

flag=[1]*N
for i in range(N-1):
  if flag[i]==0:continue
  for j in range(i+1,N):
    if flag[j]==0:continue
    if j==i+1 and A[j]==A[i]:
      flag[i] = 0
    if A[j]%A[i] == 0:
      flag[j] = 0
      
print(sum(flag))

Fixed submission:
N = int(input())
*A,=map(int,input().split())
A = sorted(A)

if N == 1:
  print(1)
  exit()

flag = [0]*(10**6+5)
for i in range(N):
  flag[A[i]] = 1

for i in range(N):
  if flag[A[i]] == 0:
    continue
  if i>0 and A[i]==A[i-1]:
    flag[A[i]] = 0
    continue
  for num in range(A[i]*2,A[-1]+1,A[i]):
    flag[num] = 0
  
print(sum(flag))

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

ok = [1 for i in range(len(A))]

for i in range(len(A)-1):
  for j in range(i+1, len(A)):
    if ok[j] == 0:
      continue
    if A[i] == A[j]:
      ok[i] = ok[j] = 0
      continue
    if A[j] % A[i] == 0:
      ok[j] = 0

print(sum(ok))

Fixed submission:
N = int(input())
*A,=map(int,input().split())
A = sorted(A)

if N == 1:
  print(1)
  exit()

flag = [0]*(10**6+5)
for i in range(N):
  flag[A[i]] = 1

for i in range(N):
  if flag[A[i]] == 0:
    continue
  if i>0 and A[i]==A[i-1]:
    flag[A[i]] = 0
    continue
  for num in range(A[i]*2,A[-1]+1,A[i]):
    flag[num] = 0
  
print(sum(flag))

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

ok = [1 for i in range(len(A))]

for i in range(len(A)-1):
  for j in range(i+1, len(A)):
    if ok[j] == 0:
      continue
    if A[i] == A[j]:
      ok[i] = ok[j] = 0
      continue
    if A[j] % A[i] == 0:
      ok[j] = 0

print(sum(ok))

Fixed submission:
N = int(input())
*A,=map(int,input().split())
A = sorted(A)

if N == 1:
  print(1)
  exit()

flag = [0]*(10**6+5)
for i in range(N):
  flag[A[i]] = 1

for i in range(N):
  if flag[A[i]] == 0:
    continue
  if i>0 and A[i]==A[i-1]:
    flag[A[i]] = 0
    continue
  for num in range(A[i]*2,A[-1]+1,A[i]):
    flag[num] = 0
  
print(sum(flag))

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

ok = [1 for i in range(len(A))]

for i in range(len(A)-1):
  for j in range(i+1, len(A)):
    if A[j] % A[i] == 0:
      ok[j] = 0
    if A[j] == A[i]:
      ok[i] = 0

print(sum(ok))

Fixed submission:
N = int(input())
*A,=map(int,input().split())
A = sorted(A)

if N == 1:
  print(1)
  exit()

flag = [0]*(10**6+5)
for i in range(N):
  flag[A[i]] = 1

for i in range(N):
  if flag[A[i]] == 0:
    continue
  if i>0 and A[i]==A[i-1]:
    flag[A[i]] = 0
    continue
  for num in range(A[i]*2,A[-1]+1,A[i]):
    flag[num] = 0
  
print(sum(flag))