Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=sorted(list(map(int,input().split())))

    l=[0]*(10**6+1)

    for i in A:
        if l[i+1]!=0:
            l[i+1]+=1
            continue
        for j in range(1,10**6//i):
            l[j*i+1]+=1
    
    cnt=0
    for i in A:
        if l[i+1]<=1:
            cnt+=1
    print(cnt)




    
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=sorted(list(map(int,input().split())))

    l=[0]*(10**6+5)

    for i in A:
        if l[i]!=0:
            l[i]+=1
            continue
        for j in range(i,10**6+5,i):
            l[j]+=1
    
    cnt=0
    for i in A:
        if l[i]==1:
            cnt+=1
    print(cnt)




    
resolve()

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=sorted(list(map(int,input().split())))

    l=[0]*(10**6+1)

    for i in A:
        for j in range(1,10**6//i):
            l[j*i+1]+=1
    
    cnt=0
    for i in A:
        if l[i+1]<=1:
            cnt+=1
    print(cnt)




    
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=sorted(list(map(int,input().split())))

    l=[0]*(10**6+5)

    for i in A:
        if l[i]!=0:
            l[i]+=1
            continue
        for j in range(i,10**6+5,i):
            l[j]+=1
    
    cnt=0
    for i in A:
        if l[i]==1:
            cnt+=1
    print(cnt)




    
resolve()

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=sorted(list(map(int,input().split())))

    l=[0]*(10**6+1)

    for i in A:
        for j in range(1,10**6//i):
            l[j*i+1]+=1
    
    cnt=0
    for i in A:
        if l[i+1]<=1:
            cnt+=1
    print(cnt)




    
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=sorted(list(map(int,input().split())))

    l=[0]*(10**6+5)

    for i in A:
        if l[i]!=0:
            l[i]+=1
            continue
        for j in range(i,10**6+5,i):
            l[j]+=1
    
    cnt=0
    for i in A:
        if l[i]==1:
            cnt+=1
    print(cnt)




    
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    A=sorted(list(map(int,input().split())))
    cnt=0
    temp=False

    for i in range(n):
        if A[i]!=0:
            val=A[i]
        if i+1<n and A[i+1]==val:
            cnt+=2
            if temp:
                cnt-=1
            temp=True
            continue
        else:
            temp=False
        for j in range(i+1,n):
            if A[j]!=0:
                if A[j]%val==0:
                    A[j]=0
                    cnt+=1
    print(n-cnt)

    
# 
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=sorted(list(map(int,input().split())))

    l=[0]*(10**6+5)

    for i in A:
        if l[i]!=0:
            l[i]+=1
            continue
        for j in range(i,10**6+5,i):
            l[j]+=1
    
    cnt=0
    for i in A:
        if l[i]==1:
            cnt+=1
    print(cnt)




    
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    A=sorted(list(map(int,input().split())))
    cnt=0

    for i in range(n):
        if i<n-1 and A[i+1]==A[i]:
            continue
        for j in range(i):
            if A[i]%A[j]==0:
                break
        else:
            cnt+=1
    print(cnt)

    
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    N=int(input())
    A=sorted(list(map(int,input().split())))

    l=[0]*(10**6+5)

    for i in A:
        if l[i]!=0:
            l[i]+=1
            continue
        for j in range(i,10**6+5,i):
            l[j]+=1
    
    cnt=0
    for i in A:
        if l[i]==1:
            cnt+=1
    print(cnt)




    
resolve()