peterverebics/CodeNet_Python_118 huggingface dataset:
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

p = list(map(int, input().split()))
pp = set(p)
numlist = [i for i in range(-1000, 1000)]
numlistt = set(numlist)
newlist = numlistt - pp
newlistt = list(newlist)
absn = 1000
ans = 1000
 
for i in newlistt:
    if absn > abs(X-i):
        ans = i
        absn = abs(X-i)
    elif absn == abs(X-i) and i < ans:
        ans = i
        absn = abs(X-i)

print(ans)
print(newlistt)
import numpy as np
x,y =map(int, input().split())
p =list(map(int, input().split()))

n = []
b=10000

for c1 in range(101):
    if c1 not in p:
        if(abs(x-b) > abs(x-c1)):
            b=c1
print(b)
x,n = map(int,input().split())

p = list(map(int,input().split()))
s = []

for i in range(101):
  if i not in p:
    s.append(i)

    
if s == [0]:
  print(x)

else:
  

  k = abs(x-s[0])
  del s[0]
  for j in range(100-n):
    if abs(x-s[j]) < k:
      k = abs(x-s[j])
    else:
      answer = s[j-1]
      break
  else:
    answer = s[100-n-1]
  print(answer)
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))
 
num_list = list(range(0,101))
y = (num_list + p)
 
counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]
 

ans = 10 *100000000000
 
for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    x, n = map(int, readline().split())
    p = list(map(int, readline().split()))
    p.sort()
    check = float('inf')
    ans = 0
    for i in range(101):
        if i not in p:
            if check > abs(x - i):
                ans = i
                check = abs(x - i)
    print(ans)


if __name__ == '__main__':
    main()
x,n = map(int,input().split())
p_lst = list(map(int,input().split()))

check = float("inf")
ans = float("inf")
for p in range(100,-101,-1):
    if p in p_lst:
        continue
    else:
        #print(p)
        if check >= abs(p-x):
            check = abs(p-x)
            ans = p
            
print(ans)
x, n = map(int, input().split())
x1 = x
x2 = x

if n == 0:
    print(x)
else:
    p = list(map(int, input().split()))
    while True:
        x1 -= 1
        x2 += 1
        
        if x1 not in p:
            print(x1)
            break
        if x2 not in p:
            print(x2)
            break
x,n = list(map(int,input().split()))
if n >0 :
  p = list(map(int,input().split()))
#print(x,n)
#print(p)
#print(max(p))
y = 100
ans = n
if n == 0:
  print(x)
else:
  for i in range(100):
    if p.count(i) == 0:
      print('i=',i,abs(x-i))
      if abs(x-i) < y:
        ans = i
        y = abs(x-i)
  print(ans)
x, n = map(int, input().split())
if n ==0:
    print(x)
else:
    p = list(map(int, input().split()))
    q = list(range(101))
    a = 1000
    for i in range(x, -1, -1):
        if p.count(i) == 0:
            a = i
            break

    b = 1000
    for i in range(x, 101):
        if p.count(i) == 0:
            b = i
            break

    if abs(x-a) > abs(x-b):
        print(b)
    else:
        print(a)
X, N = map(int, input().split())
if N>0:
  p = [int(i) for i in input().split()]
else:
  p = [-1]
  
p = sorted(p)

try:
  idx=p.index(X)
  for i in range(N//2+2):
    if idx-i<0:
      print(X-i)
      break
    elif idx+i>=N:
      print(idx, i)
      print(X+i)
      break
    elif X-i!=p[idx-i]:
      print(X-i)
      break
    elif X+i!=p[idx+i]:
      print(X+i)
      break
except:
  print(X)
x, n = map(int, input().split())
P = list(map(int, input().split()))
if not P:
    print(x)
for i in range(x, 102):
    if i not in P:
        upper = i
        break
    else:
        upper = 102
for i in range(x, -1, -1):
    if i not in P:
        lower = i
        break
    else:
        lower = 0
print(lower if x-lower <= upper - x else upper)
x,n = map(int,input().split())
p = list(map(int,input().split()))
q = set(range(1,101))
q = q - set(p)
q_list = list(q)
ans = 100
d = 100
for i in range(100-n):
   if d != min(d,abs(x - q_list[i])):
       ans = q_list[i]
       d = min(d,abs(x - q_list[i]))
print(ans)
a, b = map(int, input().split())
list2 = set(map(int, input().split()))
list1=list(range(-100,101,1))
result = list(set(list1) - set(list2))
for i in range(200):
    if a-i in result:
        print(a-i)
        exit()
    elif a+i in result:
        print(a+i)
        exit()
import sys
x,n=map(int,input().split())
p=list(map(int,input().split()))
if n==0:
    print(x)
    sys.exit()
for i in range(1,101):
    ans=x-i
    if ans<=0:
        if not ans in p:
            print(ans)
            sys.exit()
        else:
            continue
    if not ans in p:
        print(ans)
        sys.exit()
    an=x+i
    if not an in p:
        print(an)
        sys.exit()
import sys
x, n = map(int, input().split())
p = [int(x) for x in input().split()]

if n == 0:
    print(x)
    sys.exit()

diff = -1
while(True):
    if not x + diff in p:
        print(x+diff)
        sys.exit()

    if diff < 0:
        diff *= -1
        diff += 1
    else:
        diff *= -1
        diff -= 1
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
#p = [list(map(int, input().split())) for i in range(n)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
dif = 1000
ans = 1000
for i in range(-101, 101):
    if not(i in p):
        if abs(i-x) < dif:
            dif = abs(i-x)
            ans = i
        elif abs(i-x) == dif:
            if ans > i:
                ans = i
print(ans)
X,N = map(int,input().split())

if N == 0:
  print(X)
  exit();

p = [int(i) for i in input().split()]

if X not in p:
  print(X)
  exit();

if N == 1 and p[0] == X:
  print(X-1)
  exit();

for j in range(100):
  if X-j not in p and X-j >=0:
    print(X-j)
    exit();
  if X+j not in p and X+j <= 100:
    print(X+j)
    exit();
# coding: utf-8
# Your code here!

import numpy as np

x,n = map(int,input().split())

p = list(map(int,input().split()))

m = np.array(list(range(-100,200)))
m = (m-x)**2
for i in (np.argsort(m)-101):
    if p.count(i) == 0:
        print(i)
        break
def main():
    x, n = (int(i) for i in input().split())
    if n > 0:
        p = [int(i) for i in input().split()]
    else:
        p = []

    mask = [0] * 101 
    for pe in p:
        mask[pe] = 1

    b, e = x, x
    while mask[b] == 1 and mask[e] == 1:
        b -= 1
        e += 1
        b = max(0, b)
        e = min(100, e)

    if mask[b] == 0:
        print(b)
    else:
        print(e)



main()
X, N = map(int, input().split())

int_set = set(list(range(-101,101)))

for x in input().split():
    int_set.remove(int(x))

for i in range(101):
    if X - i in int_set:
        print(X - i)
        break
    elif X + i in int_set:
        print(X + i)
        break
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = list(map(int, input().split()))

for i in range(1, 100):
    i1 = x - i
    i2 = x + i
    if i1 not in p:
        print(i1)
        break
    elif i2 not in p:
        print(i2)
        break
    else:
        continue
x,n,*p=map(int,open(0).read().split())
if n==0:
    print(x)
else:
    q=[i for i in range(101) if not(i in p)]
    m=[]
    for j in q:
        m.append(abs(j-x))
    a,b=x-min(m),x+min(m)
    if a in q:
        print(a)
    else:
        print(b)
x, n = map(int, input().split())
p = list(map(int, input().split()))

px = x + 1
mx = x - 1
if n == 0:
    print(x)
    exit()

while True:
    if mx not in p:
        print(mx)
        exit()
    elif px not in p:
        print(px)
        exit()
    px += 1
    mx -= 1
X, N = map(int, input().split())
ps = list(map(int, input().split()))

#pset = set([abs(X-p) for p in ps])
#print(pset)

for i in range(50):
  if X-i not in ps:
    print(X-i)
    break
  elif X+i not in ps:
    print(X+i)
    break
X,N = map(int,input().split())
p = list(map(int,input().split()))
min = 0
i = 0
count = 0
while True:
    if abs(X - i) == min:
        if i not in p:
            break
        elif i in p and min != 0:
            count += 1
            if count == 2:
                min += 1
                count = 0
                i = 0
        else:
            min += 1
            i = 0
    i += 1

print(i)
import sys
input1 = list(map(int, input().split()))
X = input1[0]
N = input1[1]
p = list(map(int, input().split()))

if p == []:
    print(X)
    sys.exit()

# print(X)
flag = True
diff = 1
# print((X - diff) in p)
while(flag):
    if ((X - diff) in p) == False:
        answer = X - diff
        flag = False
    elif ((X + diff) in p) == False:
        answer = X + diff
        flag = False
    else:
        diff += 1

print(answer)
from collections import Counter
n = int(input())
A = sorted(map(int, input().split()))

c = Counter(A)

yes_or_no = [True for i in range(A[n-1]+1)]

for a in A:
  t = a*2
  while t <= A[n-1]:
    yes_or_no[t] = False
    t += a
ans = 0
for a in A:
  if c[a] == 1 and yes_or_no[a] == True:
    ans += 1
print(ans)
n = int(input())
a = list(map(int,input().split()))

dp = [0]*(10**6 + 1)
ans = 0

for i in a:
    if dp[i] == 0:
        for j in range(1,10**6+1):
            if i * j > 10**6:
                break
            dp[i*j] += 1
    elif dp[i] == 1:
        dp[i] += 1

for i in a:
    if dp[i] == 1:
        ans += 1


print(ans)
import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit('(i4[::1],)', cache=True)
def solve(A):
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

A = np.array(read().split(), np.int32)[1:]

print(solve(A))
import sys

n = int(input())
A = list(map(int, input().split()))
A.sort()

if len(A) == 1:
    print(1)
    sys.exit(0)

box = [False] * (A[-1] + 1)
for a in A:
    box[a] = True

for idx, a in enumerate(A):
    if A[idx] == A[idx - 1]:
        box[a] = False
    for j in range(2, A[-1]//a + 1):
        box[a * j] = False

count = 0
for d in box:
    if d:
        count += 1
print(count)
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
a.sort()
c = Counter(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and c[i] == 1:
        cnt += 1

print(cnt)
#!/usr/bin/env python3
import sys
import collections

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


N = I()
A = LI()
A.sort()
cnt = collections.Counter(A)
MAX = A[-1] + 1
# end = A[-1] ** 0.5

for a in A:
    if cnt[a] >= 2:
        del cnt[a]
    for i in range(a * 2, MAX, a):
        del cnt[i]

print(sum(cnt.values()))
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)

A = set(A)
MAX_A = 10 ** 6
X = [0] * (MAX_A + 1)
for a in A:
    for i in range(a, MAX_A + 1, a):
        X[i] += 1

ans = len([a for a in A if (X[a] == 1) and (C[a] == 1)])
print(ans)
N = 1000001
a = [0]* N
input()
for x in input().split():
  a[int(x)] += 1
for i in range(1, N):
  if a[i]:
    a[i + i::i] = (0 for _ in a[i + i::i])
print(a.count(1))
n = int(input())
A = list(map(int,input().split()))
A.sort()
# print(A)
multiple = [0]*(A[-1]+1)
for i in range(n):
    now = A[i]
    while(now <= A[-1]):
        multiple[now] += 1
        now += A[i]
ans = 0
for i in range(n):
    if(multiple[A[i]] == 1):
        ans += 1
# print(multiple)
print(ans)
M = 10 ** 6 + 5
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * M
for i in A:
    if(cnt[i] >= 2):
        continue
    for j in range(i, M, i):
        cnt[j] += 1
ans = 0
for i in A:
    if(cnt[i] == 1):
        ans += 1
print(ans)
N = int(input())
a = list(map(int, input().split()))
a.sort()
A = max(a)
b = [0]*A
for i in range(N):
  if b[a[i]-1] == 0:
    for j in range(a[i], A+1, a[i]):
      b[j-1] += 1
  elif b[a[i]-1] == 1:
      b[a[i]-1] += 1
n = 0      
for i in range(N):
  if b[a[i]-1] == 1:
    n += 1
print(n)
n=int(input())
a = list(map(int, input().strip().split()))
a.sort()
lim=10**6+1
ans=0
multiples=[False]*lim

for i in range(n):
    if multiples[a[i]]==True:
        continue
    elif i!=n-1 and a[i]==a[i+1]:
        pass
    else:
        ans+=1
    for j in range(a[i],lim,a[i]):
        multiples[j]=True

print(ans)
N = int(input())
A = list(map(int,input().split()))
T = set()
def counter(array):
    from collections import Counter
    return Counter(array)
c = counter(A)
for x in A:
    T.add(x)
cnt = 0
maxi = max(A)
for x in sorted(A):
    i = 2
    while x * i <= maxi:
        if x * i in T:
            T.remove(x*i)
        i += 1
ans = 0
for x in T:
    if c[x] == 1:
        ans += 1
print(ans)
from collections import Counter
n = int(input())
A = tuple(map(int, input().split()))
C = Counter(A)
A = list(set(A))
ok = [True] * (10**6+1)

for a in A:
    temp = a+a
    while temp < 10**6+1:
        ok[temp] = False
        temp += a

c = 0
for a in A:
    if C[a] == 1 and ok[a] == True:
        c += 1
print(c)
n=int(input())
l=list(map(int,input().split()))
ml=max(l)
m=[0]*(ml+1)
for i in l:
    m[i]+=1
for i in range(ml+1):
    if m[i]>=1:
        for j in range(2*i,ml+1,i):
            if m[j]>0:
                m[j]=0
                #print(j)
for i in range(ml+1):
    if m[i]>=2:
        m[i]=0
print(sum(m))
n = int(input())
a_list = list(map(int,input().split()))
a_list = sorted(a_list)
flag  = [0]*n


ans = 0
m = max(a_list)
b_list = [0]*(m+1)
for i in a_list:
    b_list[i] += 1
for i in a_list:
    if b_list[i] == 1:
        ans += 1

    for j in range(i , m+1 ,i):
        b_list[j]+= 1
print(ans)
from collections import Counter
import math

N = int(input())
a = list(map(int,input().split()))

a.sort()

is_prime = [True]*(10**6 + 1)

is_prime[0] = False

maxA = max(a)

for i in set(a):
    for j in range(2 * i, maxA+1, i):
        is_prime[j] = False

result = 0
c = Counter(a)

for e in set(a):
        if is_prime[e] and c[e] == 1:
    #        print('e = {}'.format(e))
             result += 1

print(result)
import collections 
n,cc = int(raw_input()), collections.Counter(map(int,raw_input().split()))
m,s = max(cc.keys()),{ai:True for ai in cc}
for a in cc:
	c = a if cc[a] > 1 else 2 * a
	while(c <= m):
		if a in s: s[c] = False
		c += a
count = 0
for v in s.values():
	if v: count +=1
print count
n = int(input())
A = list(map(int, input().split()))
A.sort()

cnt = [0] * (10**6+1)
for a in A:
    if cnt[a] != 0:
        cnt[a] += 1
        continue
    for i in range(10**6+1)[a::a]:
        cnt[i] += 1
ans = 0
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)
n = int(input())
*A, = map(int, input().split())
maxA = max(A)
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
D = {a: 0 for a in A}
for a in A:
    if C[a] > 1:
        D[a] = 1
    for b in range(2 * a, maxA + 1, a):
        D[b] = 1
print(sum([D[a] == 0 for a in A]))
import sys
input = sys.stdin.readline
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A.sort()

C = Counter(A)
cannot = set()
L= max(A)
ans = 0
for a in A:
    if a in cannot: continue
    if C[a] == 1:
        ans += 1
    ind = 1
    while a*ind <= L:
        cannot.add(a*ind)
        ind += 1

print(ans)
import numpy as np
from collections import Counter

length=int(input())
list=list(map(int,input().split()))
list.sort()

max=list[-1]
dp=[0]*(max+1)
dp=np.array(dp,int)

for num in list:
    dp[num]=1

for num in list:
    if dp[num]==1:
        dp[2*num::num]=0

count=Counter(list)

for num,cnt in count.items():
    if cnt>1:
        dp[num]=0

print(dp.sum())
n = int(input())
a = list(map(int, input().split()))
 
xs = [0] * (max(a) + 1)
 
for v in a:
    if xs[v] == 0:
        for j in range(v, len(xs), v):
            xs[j] += 1
    else:
        xs[v] += 1
print(len(list(filter(lambda v: xs[v] == 1, a))))
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
m = 1000005

count = 0
cnt = [0] * m
for i in range(n):
  if cnt[a[i]] == 0:
    for j in range(a[i], m, a[i]):
      cnt[j] += 1
  else:
    cnt[a[i]] = 2
for i in range(n):
  if cnt[a[i]] == 1:
    count += 1
print(count)
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split()))
    MAX = max(A)
    dp = [True] * (MAX+1)
    A.sort()
    cnt = Counter(A)
    ans = 0
    for a in A:
        if dp[a]:
            if cnt[a] == 1:
                ans += 1
            x = a
            while x <= MAX:
                dp[x] = False
                x += a
    print(ans)


if __name__ == "__main__":
    main()
N = int(input())
A = [int(x) for x in input().split()]
count = [0 for _ in range(10**6+10)]
for a in A:
    if count[a] > 1:
        continue
    for x in range(0, 10**6+10, a):
        count[x] += 1
ans = 0
for a in A:
    if count[a] == 1:
        ans += count[a]
print(ans)
N=int(input())
A=sorted(map(int,input().split()))
m=max(A)
ans=0
dp=[True]*(m+1)
for i in range(N):
    if not dp[A[i]]:
        continue
    if i==N-1:
        ans+=1
    elif i<N-1 and A[i+1]!=A[i]:
        ans+=1
    for j in range(1,m//A[i]+1):
        dp[A[i]*j]=False
print(ans)
def main():
    n = int(input())
    a = list(map(int, input().split()))

    a.sort()
    tf = [0] * (a[-1] + 1)
    for ea in a:
        tf[ea] = 1
    for i1 in range(n - 1):
        if a[i1] == a[i1 + 1]:
            tf[a[i1]] = 0

        for i2 in range(2, a[-1]//a[i1] + 1):
            tf[a[i1] * i2] = 0
    r = sum(tf)
    print(r)


if __name__ == '__main__':
    main()
n=int(input())
b=list(map(int,input().split()))
ans=0
w=max(b)
a=[0]*(w+1)
for i in b:
  x=i
  while x<=w:
    a[x]+=1
    x+=i
for i in b:
  if a[i]==1:
    ans+=1
print(ans)
M = 10 ** 6 + 1
N = int(input())
A = list(map(int, input().split()))

A.sort()
numbers = range(M)
not_divisible = [True] * (M)

result = 0
for i in range(N):
    target = A[i]
    if not_divisible[target]:
        if i+1 <= N-1 and A[i+1] == A[i]:
            pass
        else:
            result += 1
        for j in range(target, M, target):
            not_divisible[j] = False
print(result)
n = int(input())
as_ = list(map(int, input().split()))
as_ = sorted(as_)

num = 0

a_max = max(as_)
a_valid_map = [True] * (a_max + 1)
for i in range(len(as_) - 1):
    a = as_[i]
    if a_valid_map[a]:
        for j in range(a_max // a + 1):
            a_valid_map[a * j] = False
        if a != as_[i + 1]:
            num += 1
if a_valid_map[a_max]:
    num += 1

print(num)
n = int(input())
a = list(map(int, input().split()))
a.sort()
furui = [False] * (10**6+1)
ans = 0
for i in range(n):
    if i-1 >= 0 and a[i] == a[i-1]:
        continue
    if furui[a[i]] == False:
        if (i + 1 < n and a[i] != a[i + 1]) or i==n-1:
            ans += 1
        now = a[i]
        while now <= 10**6:
            furui[now] = True
            now += a[i]
print(ans)
n = int(input())
data = list(map(int, input().split()))
mx = max(data)
marked = [0]*(mx + 1)
for a in data:
    for x in range(a, mx+1, a):
        marked[x] += 1
ans = 0
for a in data:
    if marked[a] == 1:
        ans += 1
print(ans)
n = int(input())
a = list(map(int,input().split()))
amax = max(a)
ans = 0
numlist = [0] * amax

for i in range(n):
    if numlist[a[i]-1] != 0:
        numlist[a[i]-1] = 2
        continue
    else:
        for j in range(1, amax // a[i] + 1):
            numlist[a[i] * j - 1] += 1
for i in range(n):
    if numlist[a[i]-1] == 1:
        ans += 1
        
print(ans)
def abc170_d():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    Amax = A[-1]
    check = [False] * (Amax + 1)
    ans = 0
    for i in range(N):
        if check[A[i]]: continue
        if not(i < N-1 and A[i] == A[i+1]): ans += 1
        k = 1
        while k*A[i] <= Amax:
            check[k*A[i]] = True
            k += 1
    print(ans)

abc170_d()
import sys
from collections import Counter
def input(): return sys.stdin.readline().rstrip()
# ----------------------------------------------------------- #

n = int(input())
A = list(int(x) for x in input().split())
A.sort()
counter = Counter(A)
ans = 0
cache = set()
for a in A:
    if a in cache:
        continue
    tmp = a
    while tmp <= 10**6:
        cache.add(tmp)
        tmp += a
    if counter[a] == 1:
        ans += 1
print(ans)
from collections import Counter
from operator import mul
from functools import reduce


n = int(input())
A = list(map(int, input().split()))
cnt_a = Counter(A)
memo = [1] * 1000001
for a in A:
    memo[a] = 1
A.sort()
a_max = max(A)
for a in A:
    if not memo[a]:
        continue
    for i in range(a * 2, a_max + 1, a):
        memo[i] = -1
for l in cnt_a.keys():
    if cnt_a[l] >= 2:
        memo[l] = "daburi"
ans = 0
for a in A:
    if memo[a] == 1:
        ans += 1
print(ans)
n = int(input())
a_li = list(map(int,input().split()))
cnt = [0]*(10**6+1)


for i in a_li:
    cnt[i] += 1
unique = []
for i in range(10**6+1):
    if cnt[i] == 1:
        unique.append(i)
#print(unique)

a_li = set(a_li)

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

for i in a_li:
    for j in range(i * 2, 10 ** 6 + 1, i):
        cnt[j] = 1

ans = 0
for i in unique:
    if cnt[i] == 0:
        ans += 1
print(ans)
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]+1
  tf=[False]*maxa
  r=0
  n-=1
  for i in range(n):
    a_i=a[i]
    if tf[a_i] ==False:
      for j in range(a_i,maxa,a_i):
        tf[j]=True
      if a_i < a[i+1]:
        #print(a_i)
        r+=1
  if tf[-1] ==False:
    r+=1
  print(r)
main()
n=int(input())
a=list(map(int,input().split()))
a.sort()
f=[1]*(10**6+10)
from collections import Counter
c=Counter(a)
ans=0
for ai in a:
  if c[ai]==1 and f[ai]==1:ans+=1
  if f[ai]==1:
    for i in range(ai,10**6+10,ai):
      f[i]=0
print(ans)
import sys
from collections import Counter

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))
A.sort()
B = [0] * (A[-1] + 1)
C = Counter(A)

res = 0
for a in A:
    if B[a] == 0 and C[a] == 1:
        res += 1
    for i in range(a, A[-1] + 1, a):
        B[i] += 1

print(res)
#!/usr/bin/env python

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

a = sorted(a)
ma = a[-1]
div = [0 for _ in range(ma+1)]

for i in range(n):
    for j in range(a[i], ma+1, a[i]):
        div[j] += 1

ans = 0 
for i in range(n):
    if div[a[i]] == 1:
        ans += 1
print(ans)
# D - Not Divisible
from collections import deque
N = int(input())
A = list(map(int,input().split()))
A.sort()
A = deque(A)
B = [0]*(10**6+1)
ans = 0
for _ in range(N):
    x = A.popleft()
    if B[x]==0:
        ans += 1
        B[x] = 2
        tmp = 2*x
        while tmp<=10**6:
            B[tmp] = 1
            tmp += x
    elif B[x]==2:
        B[x] = 1
        ans -= 1
print(ans)
n=int(input())
a=list(map(int,input().split()))
m=max(a)
l=[0for i in range(m+1)]
for i in range(n):
 for j in range(a[i], m + 1, a[i]):l[j] += 1
c=0
for i in range(n):
 if l[a[i]] == 1:c += 1
print(c)
n=int(input())
a=list(map(int, input().split()))

from collections import Counter
c=Counter(a)

max_a=max(a)
bls=[0]*(max_a+1)
for a_i in a:
    for j in range(a_i, max_a+1, a_i):
        bls[j]+=1
ans=0
for a_i in a:
    if bls[a_i]==1 and c[a_i]==1:
        ans+=1
print(ans)
from collections import Counter


N = int(input())
A = sorted(map(int, input().split()))

sifter = {i: True for i in range(1, A[N - 1] + 1)}
counter = Counter(A)
ans = 0
for A_i in A:
  if sifter[A_i]:
    if counter[A_i] == 1:
      ans += 1
    for i in range(A_i, A[N - 1] + 1, A_i):
      sifter[i] = False
      
print(ans)
N = int(input())
A = list(map(int,input().split()))
ans = [0]*(10**6+1)
mul = set()
for i in range(N):
	if ans[A[i]] == 0:
		ans[A[i]] = 1
		p = A[i]*2
		while p <= 10**6:
			ans[p] = -1
			p += A[i]
	elif ans[A[i]] == 1:
		ans[A[i]] = 2

q = 0	
for i in range(10**6+1):
	if ans[i] == 1:
		q += 1
print(q)