Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
orga = list(map(int, input().split()))

if n==1:
    print(1)
    exit()
if len(set(orga)) == 1:
    print(0)
    exit()

import collections
c = collections.Counter(orga)
a=[]
for itm in c.items():
    num,cnt=itm
    if cnt==1:
        a.append(num)

aset=set(orga)

def m_div(n,aset):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i!=n and i in aset:
                return False
            if i != n // i:
                if (n//i != n) and (n//i in aset):
                    return False
    return True

ans=0
for num in a:
    if m_div(num,aset):
        ans+=1

print(ans)

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

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

maxa=max(a)
dp=[0]*(maxa+100)
for num in a:
    for i in range(2,10**10):
        if num*i > (maxa+50):
            break
        dp[num*i]=1

import collections
c = collections.Counter(a)

aa=[]
for itm in c.items():
    num,cnt=itm
    if cnt==1:
        aa.append(num)

ans=0
for num in aa:
    if dp[num]==0:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n = int(input())
orga = list(map(int, input().split()))

if n==1:
    print(1)
    exit()
if len(set(orga)) == 1:
    print(0)
    exit()

import collections
c = collections.Counter(orga)
a=[]
for itm in c.items():
    num,cnt=itm
    if cnt==1:
        a.append(num)

aset=set(orga)

def m_div(n,aset):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i!=n and i in aset:
                return False
            if i != n // i:
                if (n//i != n) and (n//i in aset):
                    return False
    return True

ans=0
for num in a:
    if m_div(num,aset):
        ans+=1

print(ans)

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

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

maxa=max(a)
dp=[0]*(maxa+100)
for num in a:
    for i in range(2,10**10):
        if num*i > (maxa+50):
            break
        dp[num*i]=1

import collections
c = collections.Counter(a)

aa=[]
for itm in c.items():
    num,cnt=itm
    if cnt==1:
        aa.append(num)

ans=0
for num in aa:
    if dp[num]==0:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n = int(input())
orga = list(map(int, input().split()))

if n==1:
    print(1)
    exit()
if len(set(orga)) == 1:
    print(0)
    exit()

import collections
c = collections.Counter(orga)
a=[]
for itm in c.items():
    num,cnt=itm
    if cnt==1:
        a.append(num)

aset=set(orga)

def m_div(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    divisors.remove(n)
    return divisors

ans=0
for num in a:
    divset=m_div(num)
    if len(divset & aset)==0:
        ans+=1

print(ans)

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

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

maxa=max(a)
dp=[0]*(maxa+100)
for num in a:
    for i in range(2,10**10):
        if num*i > (maxa+50):
            break
        dp[num*i]=1

import collections
c = collections.Counter(a)

aa=[]
for itm in c.items():
    num,cnt=itm
    if cnt==1:
        aa.append(num)

ans=0
for num in aa:
    if dp[num]==0:
        ans+=1
print(ans)