Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in range(1,len(nums)):
  cnt[i] = cnt.get(i,0) + 1

    
for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  for j in range(i*2,1000000,i):
    flag[j] = 1

print(ans)

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000000
for i in range(1,len(nums)):
  if nums[i] == nums[i-1]:
    flag[nums[i]] = 1

    
for i in range(len(nums)):
  if flag[nums[i]] == 0:
    ans += 1
  if flag[nums[i]*2] == 0:
    for j in range(nums[i]*2,1000000,nums[i]):
      flag[j] = 1

print(ans)


Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000000
for i in range(1,len(nums)):
  if nums[i] == nums[i-1]:
    flag[nums[i]] = 1

    
for i in range(len(nums)-1):
  if flag[nums[i]] == 0:
    ans += 1
  if nums[i] != nums[i+1]:
    n = nums[i]
    while n <1000000:
      flag[n] = 1
      n = n+ nums[i]

if flag[nums[-1]] == 0:
  ans +=1

print(ans)

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000000
for i in range(1,len(nums)):
  if nums[i] == nums[i-1]:
    flag[nums[i]] = 1
    
if flag[nums[0]] == 0:
  ans +=1
    
for i in range(1,len(nums)):
  if flag[nums[i]] == 0:
    ans += 1
  if nums[i] != nums[i-1]:
    n = nums[i]
    while n <1000000:
      flag[n] = 1
      n = n+ nums[i]

print(ans)

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
div = []
for i in nums:
  cnt[i] = cnt.get(i,0) + 1
  flag = 0
  for j in div:
    if i%j == 0:
      flag = 1
      break
  if flag == 0: 
    div.append(i)
    
for i in div:
  if cnt[i] == 1:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
unique = []
dupes = {}
for i in range(len(nums)):
  flag = 0
  for j in range(len(unique)):
    if i==j:
      continue
    if nums[i]%unique[j] == 0:
      if nums[i] == unique[j]:
        dupes[nums[i]] = 1
      flag = 1
      break
  if flag == 0:
    unique.append(nums[i])
for i in unique:
  if i in dupes:
    unique.remove(i)
print(len(unique))

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
unique = []
for i in range(len(nums)):
  flag = 0
  for j in range(len(nums)):
    if i==j:
      continue
    if nums[i]%nums[j] == 0:
      flag = 1
      break
  if flag ==0:
    unique.append(nums[i])
print(len(unique))


Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
unique = []
for i in range(len(nums)):
  flag = 0
  for j in range(len(nums)):
    if i==j:
      continue
    if nums[i]%nums[j] == 0:
      flag = 1
  if flag ==0:
    unique.append(nums[i])
print(len(unique))


Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
nums.sort()
ans = 0
cnt = {}
flag = [0]*1000005
for i in nums:
  cnt[i] = cnt.get(i,0) + 1

for i in nums:
  if flag[i] == 0 and cnt[i] == 1:
    ans += 1
  if flag[i] == 1:
    continue
  for j in range(i,1000001,i):
    flag[j] = 1

print(ans)