Buggy python submission (verdict: Time Limit Exceeded):
#dame datta....
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    a = Counter(A)
    l = [0] * (10**6+1)
    for i in A:
        t = 2*i
        while t < 10**6 + 1:
            l[t] = 1
            t += i
    r = 0
    for i in A:
        if l[i] == 0 and a[i] == 1:
            r += 1
    return r
print(main())


Fixed submission:
#dame datta....
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = sorted(A)
    a = Counter(A)
    l = [0] * (10**6+1)
    v = [0] * (10**6+1)
    for i in B:
        if v[i] == 1 or l[i] == 1:
            continue
        else:
            v[i] = 1
        t = 2*i
        while t < 10**6 + 1:
            l[t] = 1
            t += i
    r = 0
    for i in A:
        if l[i] == 0 and a[i] == 1:
            r += 1
    return r
print(main())

Buggy python submission (verdict: Time Limit Exceeded):
#dame datta....
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    a = Counter(A)
    l = [0] * (10**6+1)
    for i in A:
        t = 2*i
        while t < 10**6 + 1:
            l[t] = 1
            t += i
    r = 0
    for i in A:
        if l[i] == 0 and a[i] == 1:
            r += 1
    return r
print(main())


Fixed submission:
#dame datta....
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = sorted(A)
    a = Counter(A)
    l = [0] * (10**6+1)
    v = [0] * (10**6+1)
    for i in B:
        if v[i] == 1 or l[i] == 1:
            continue
        else:
            v[i] = 1
        t = 2*i
        while t < 10**6 + 1:
            l[t] = 1
            t += i
    r = 0
    for i in A:
        if l[i] == 0 and a[i] == 1:
            r += 1
    return r
print(main())

Buggy python submission (verdict: Time Limit Exceeded):
import math
from collections import Counter

def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors


def main():
    N = int(input())
    A = list(map(int, input().split()))
    a = Counter(A)
    if a[1] > 1:
        return 0
    if a[1] == 1:
        return 1
    b = set(A)
    c = {}
    def find(x):
        if x in c:
            return c[x]
        l = make_divisors(x)
        for j in l:
            if j == x:
                if a[j] > 1:
                    c[x] = 0
                    return 0
            else:
                if j in b:
                    c[x] = 0
                    return 0
        c[x] = 1
        return 1
    r = 0
    for i in A:
        r += find(i)
    return r
print(main())



Fixed submission:
#dame datta....
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = sorted(A)
    a = Counter(A)
    l = [0] * (10**6+1)
    v = [0] * (10**6+1)
    for i in B:
        if v[i] == 1 or l[i] == 1:
            continue
        else:
            v[i] = 1
        t = 2*i
        while t < 10**6 + 1:
            l[t] = 1
            t += i
    r = 0
    for i in A:
        if l[i] == 0 and a[i] == 1:
            r += 1
    return r
print(main())

Buggy python submission (verdict: Time Limit Exceeded):
import math
from collections import Counter

def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors


def main():
    N = int(input())
    A = list(map(int, input().split()))
    a = Counter(A)
    b = set(A)
    c = {}
    def find(x):
        if x in c:
            return c[x]
        l = make_divisors(x)
        for j in l:
            if j == x:
                if a[j] > 1:
                    c[x] = 0
                    return 0
            else:
                if j in b:
                    c[x] = 0
                    return 0
        c[x] = 1
        return 1
    r = 0
    for i in A:
        r += find(i)
    return r
print(main())


Fixed submission:
#dame datta....
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = sorted(A)
    a = Counter(A)
    l = [0] * (10**6+1)
    v = [0] * (10**6+1)
    for i in B:
        if v[i] == 1 or l[i] == 1:
            continue
        else:
            v[i] = 1
        t = 2*i
        while t < 10**6 + 1:
            l[t] = 1
            t += i
    r = 0
    for i in A:
        if l[i] == 0 and a[i] == 1:
            r += 1
    return r
print(main())

Buggy python submission (verdict: Time Limit Exceeded):
import math
from collections import Counter

def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors


def main():
    N = int(input())
    A = list(map(int, input().split()))
    a = Counter(A)
    b = set(A)
    def find(x):
        l = make_divisors(x)
        for j in l:
            if j == x:
                if a[j] > 1:
                    return 0
            else:
                if j in b:
                    return 0
        return 1
    r = 0
    for i in A:
        r += find(i)
    return r
print(main())


Fixed submission:
#dame datta....
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = sorted(A)
    a = Counter(A)
    l = [0] * (10**6+1)
    v = [0] * (10**6+1)
    for i in B:
        if v[i] == 1 or l[i] == 1:
            continue
        else:
            v[i] = 1
        t = 2*i
        while t < 10**6 + 1:
            l[t] = 1
            t += i
    r = 0
    for i in A:
        if l[i] == 0 and a[i] == 1:
            r += 1
    return r
print(main())

Buggy python submission (verdict: Time Limit Exceeded):
import math
from collections import Counter

def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors


def main():
    N = int(input())
    A = list(map(int, input().split()))
    a = Counter(A)
    def find(x):
        l = make_divisors(x)
        for j in l:
            if j == x:
                if a[j] > 1:
                    return 0
            else:
                if j in a:
                    return 0
        return 1
    r = 0
    for i in A:
        r += find(i)
    return r
print(main())


Fixed submission:
#dame datta....
from collections import Counter
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = sorted(A)
    a = Counter(A)
    l = [0] * (10**6+1)
    v = [0] * (10**6+1)
    for i in B:
        if v[i] == 1 or l[i] == 1:
            continue
        else:
            v[i] = 1
        t = 2*i
        while t < 10**6 + 1:
            l[t] = 1
            t += i
    r = 0
    for i in A:
        if l[i] == 0 and a[i] == 1:
            r += 1
    return r
print(main())