Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]

for x in p:
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
 
c = Counter(p)
for (k,v) in c.items():
    if v>1:
        s.discard(k)
print(len(s))


Fixed submission:
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=sorted(list(map(int,input().split())))
s=[]
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
flag = True
for x in p:
    if prev == x:
        if flag and s[-1] == x:
            s.pop()
            flag = False
        continue
    if a[x]:
        s.append(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x
    flag = True

print(len(s))

Fixed submission:
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=sorted(list(map(int,input().split())))
s=[]
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
flag = True
for x in p:
    if prev == x:
        if flag:
            s.pop()
            flag = False
        continue
    if a[x]:
        s.append(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x
    flag = True

print(len(s))

Fixed submission:
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=sorted(list(map(int,input().split())))
s=[]
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
flag = True
for x in p:
    if prev == x and flag:
        s.pop()
        flag = False
        continue
    if a[x]:
        s.append(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x
    flag = True

print(len(s))

Fixed submission:
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))

Fixed submission:
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]

for x in p:
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
 
c = Counter(p)
for (k,v) in c.items():
    if v>1:
        s.discard(k)
print(len(s))

Fixed submission:
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
for x in p:
    i=1
    flag = True
    while i*i<=x:
        if x%i==0:
            a=x//i
            b=x//a
            if a in s or b in s:
                flag = False
                break
        i+=1
    if flag:
        s.add(x)

c = Counter(p)
for (k,v) in c.items():
    if v>1:
        s.discard(k)
print(len(s))

Fixed submission:
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))