CodeEff/ECCO huggingface dataset:
# Original solution
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(eval(input()))
def F(): return float(eval(input()))
def S(): return eval(input())
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N = I()
    A = LI()

    cnt = collections.Counter(A)
    A = list(set(A))
    A.sort()
    A_max = A[-1]
    divisible = [False] * (A_max + 1)

    for i in A:
        for j in range(2 * i, A_max+1, i):
            divisible[j] = True

    ans = 0
    for i in A:
        tmp = 0
        if not divisible[i] and cnt[i] == 1:
            tmp += 1
        ans += tmp

        
    print(ans)

if __name__ == '__main__':
    resolve()

# Optimized solution
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(eval(input()))
def F(): return float(eval(input()))
def S(): return eval(input())
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N = I()
    A = LI()

    cnt = collections.Counter(A)
    A = list(set(A))
    A.sort()
    A_max = A[-1]
    divisible = [False] * (A_max + 1)

    for i in A:
        for j in range(2 * i, A_max+1, i):
            divisible[j] = True

    ans = 0
    for i in A:
        if not divisible[i] and cnt[i] == 1:
            ans += 1
        
    print(ans)

if __name__ == '__main__':
    resolve()
# Original solution
import sys
from collections import Counter
input = lambda: sys.stdin.readline().rstrip()

MAX = 1000001
dp = [True for _ in range(MAX)]
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
cnt = Counter(a)
ans = 0
for v in a:
   if cnt[v] <= 1 and dp[v]:
      ans += 1
   m = v
   while m < MAX:
      dp[m] = False
      m += v
print(ans)

# Optimized solution
import sys
from collections import Counter
input = lambda: sys.stdin.readline().rstrip()

MAX = 1000001
dp = [True for _ in range(MAX)]
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = Counter(a)
a = sorted(list(set(a)))
ans = 0
for v in a:
   if cnt[v] <= 1 and dp[v]:
      ans += 1
   m = v
   while m < MAX:
      dp[m] = False
      m += v
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()

res = 0
cnt = [False] * a[-1]
for i in range(n):
    j = 1
    while j * j <= a[i]:
        if a[i] % j == 0 and (cnt[j-1] or cnt[a[i]//j-1]):
            res += 1
            break
        j += 1
    if j * j > a[i] and i + 1 < n and a[i] == a[i+1]:
        res += 1
    cnt[a[i]-1] = True

print((n - res))

# Optimized solution
n = int(eval(input()))
a = sorted(list(map(int, input().split())))

used = [False] * a[-1]
res = 0
for i in range(n):
    if used[a[i]-1]:
        continue
    if i == n - 1 or a[i] != a[i+1]:
        res += 1
    for j in range(a[i], a[-1]+1, a[i]):
        used[j-1] = True

print(res)
# Original solution
n = int(eval(input()))
A = [int(x) for x in input().split()]
A.sort()
ans = 0
for i, a in enumerate(A):
    if i != n - 1 and A[i + 1] == a:
        continue
    do_count = True
    for j in range(i):
        b = A[j]
        if a % b == 0:
            do_count = False
            break
    if do_count:
        ans += 1
print(ans)


# Optimized solution
n = int(eval(input()))
A = [int(x) for x in input().split()]
A.sort()
lim = A[-1]
se = [True for i in range(lim + 1)]
ans = 0
for i, a in enumerate(A):
    if se[a]:
        if not((i != n - 1 and A[i + 1] == a) or (i != 0 and A[i - 1] == a)):
            ans += 1
        tmp = a
        while not tmp > lim:
            se[tmp] = False
            tmp += a
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
T = [1] * N
for i in range(N):
  if T[i] == 1:
    for j in range(N):
      if i != j:
        if A[i] == A[j]:
          T[i] = 0
        if T[j] == 1 and A[j] % A[i] == 0:
          T[j] = 0
print((sum(T)))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
M = max(A)
num = [0] * (M)
T = [0] * (M)
for a in A:
  num[a-1] += 1
  T[a-1] = 1
for i in range(M):
  if num[i] != 0 and T[i] == 1:
    n = 2 * (i + 1)
    while n <= M:
      T[n-1] = 0
      n += (i + 1)
ans = 0
for i in range(M):
  if T[i] == 1 and num[i] == 1:
    ans += 1
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
res = 0
while A:
    if len(A) == 1:
        res += 1
    else:
        if A[0] != A[1]:
            res += 1
    t = A[0]
    NA = []
    for a in A:
        if a % t != 0:
            NA.append(a)
    A = NA[:]
print(res)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
MA = max(A)
dp = [True for _ in range(MA+1)]
flag = [False for _ in range(MA+1)]

for i in range(N):
    a = A[i]
    if not flag[a]:
        flag[a] = True
        t = a*2
        while t <= MA:
            dp[t] = False
            t += a
    elif flag[a] == 1:
        dp[a] = False
res = 0
for a in A:
    if dp[a]:
        res += 1
print(res)
# Original solution
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


N = int(eval(input()))
A = list(map(int, input().split()))
setA = set(A)
dup = set([x for x in setA if A.count(x) > 1])

count = 0
for i in range(len(A)):
    flag = False
    if A[i] in dup:
        continue
    for div in make_divisors(A[i]):
        if div == A[i]:
            continue
        elif div in setA:
            flag = True
            break
    if not flag:
        count += 1

print(count)


# Optimized solution
# エラトステネスの篩

N = int(eval(input()))
A = sorted(map(int, input().split()))
maxA = A[N - 1]
dp = [0] * (maxA + 1)

for i in range(len(A)):
    cursor = A[i]
    while cursor <= maxA:
        dp[cursor] += 1
        cursor += A[i]

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

print(ans)
# Original solution
n = int(eval(input()))
l = sorted(list(map(int,input().split())))

num = max(l)+1
rcd = [0 for _ in range(num)]

for i in range(1, num):
    for j in l:
        if i % j == 0:
            rcd[i] += 1
            if rcd[i] >= 2:
                break
        else:
            continue

ans = 0
for k in l:
    if rcd[k] == 1:
        ans += 1

print(ans)

# Optimized solution
n = int(eval(input()))
l = list(map(int,input().split()))

num = max(l)+1
rcd = [0 for _ in range(num)]

for v in l:
    rcd[v] += 1

unq = []
for w in range(num):
    if rcd[w] == 1:
        unq.append(w)
#print(unq)

rcd = [0 for _ in range(num)]
l = set(l)
for x in l:
    for y in range(2*x, num, x):
        rcd[y] = 1
#print(rcd)

ans = 0
for z in unq:
    if rcd[z] == 0:
        ans += 1
print(ans)
# Original solution
n = int(eval(input()))
l = list(map(int,input().split()))

num = max(l)+1
rcd = [0 for _ in range(num)]

for v in l:
    rcd[v] += 1

unq = []
for w in range(num):
    if rcd[w] == 1:
        unq.append(w)
#print(unq)

rcd = [0 for _ in range(num)]
l = set(l)
for x in l:
    for y in range(2*x, num, x):
        rcd[y] = 1
#print(rcd)

ans = 0
for z in unq:
    if rcd[z] == 0:
        ans += 1
print(ans)


# Optimized solution
# '重複する要素があると条件から逸脱する' と '他の要素が約数になると条件から逸脱する' 
# 上記2つの問題を 前半と後半に分けて処理する、

n = int(eval(input()))
l = list(map(int,input().split()))

# 重複問題
num = max(l)+1
rcd = [0 for _ in range(num)] # indexを数列Aと読み替え可能な配列として初期化

for v in l: # 重複する配列を区別するため各要素数をカウントして...
    rcd[v] += 1

unq = []
for w in range(num): # 重複がない要素のみ'unq'に集約
    if rcd[w] == 1: # 1個の場合のみが該当
        unq.append(w)
#print(unq)

# 約数問題
rcd = [0 for _ in range(num)] # 再度初期化
l = set(l) # ここでは重複を考慮しないため集合化
for x in l: # 自身以外の約数の有無を確認するためのループ
    for y in range(2*x, num, x): # ※自身を約数としてカウントしない工夫！
        rcd[y] = 1 # 自身以外の約数がある場合は'1'が代入される
#print(rcd)

# まとめ
ans = 0
for z in unq: # 'unq'の中で...
    if rcd[z] == 0: # 自身以外に約数を持たない要素のみを...
        ans += 1 # カウント
print(ans)
# Original solution
from sys import stdin, stdout

int_in = lambda: int(stdin.buffer.readline())
arr_in = lambda: [int(x) for x in stdin.buffer.readline().split()]
out = lambda o: stdout.write("{}\n".format(o))

def divisors(n, items_in_a):
    i = 2
    result = set()
    while i * i <= n:
        if n % i == 0:
            opp = n // i
            if i in items_in_a or opp in items_in_a:
                return [n] # short circuit hack
            result.add(i)
            result.add(opp)
        i += 1
    return result

def solve(n, a):
    counts = {}
    for item in a:
        if item not in counts:
            counts[item] = 0
        counts[item] += 1
    if 1 in counts:
        return 1 if counts[1] == 1 else 0
    items_in_a = set(a)
    result = 0
    for item in a:
        if counts[item] == 1:
            d = divisors(item, items_in_a)
            if len(items_in_a.intersection(d)) == 0:
                result += 1
    return result


if __name__ == "__main__":
    n = int_in()
    a = arr_in()
    out(solve(n, a))

# Optimized solution
from math import sqrt
from sys import stdin, stdout
out = lambda o: stdout.write("{}\n".format(o))


def solve(a):
    a.sort()
    size = a[-1] + 1

    seive = [1] * size

    seen = set()
    for item in a:
        if item in seen:
            seive[item] = 0
        seen.add(item)

    for item in a:
        for j in range(2 * item, size, item):
            seive[j] = 0

    return sum([seive[x] for x in a])


if __name__ == "__main__":
    n = int(stdin.buffer.readline())
    a = [int(x) for x in stdin.buffer.readline().split()]
    out(solve(a))
# Original solution
n = int(eval(input()))
a_list = list(map(int, input().split()))
a_list.sort()
a_max = a_list[-1]

dup_set = set(x for x in set(a_list) if a_list.count(x) > 1)
divisible = [False] * (a_max + 1)

count = 0
i = 0
for a in a_list:
    if divisible[a]:
        continue
    if not a in dup_set:
        count += 1
    x = a
    while x <= a_max:
        divisible[x] = True
        x += a
print(count)

# Optimized solution
n = int(eval(input()))
a_list = list(map(int, input().split()))
a_list.sort()
a_max = a_list[-1]

divisible = [False] * (a_max + 1)

count = 0
i = 0
for i in range(n):
    if divisible[a_list[i]]:
        continue
    if i < n - 1 and a_list[i] == a_list[i + 1]:
        while i < n - 1 and a_list[i] == a_list[i + 1]:
            i += 1
    else:
        count += 1
    x = a_list[i]
    while x <= a_max:
        divisible[x] = True
        x += a_list[i]
print(count)
# Original solution
from collections import Counter

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

cnt = Counter(A) 

A = list(set(A))
A.sort()


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

for a in A:
    if cnt[a] == 1 and C[a] == 0:
        ans += 1

    i = 1
    while True:
        if a*i > 10**6:
            break
        C[a*i] = 1
        i += 1

print(ans)

# Optimized solution
from collections import Counter

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

cnt = Counter(A) 

A = list(set(A))
A.sort()


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

for a in A:
    if C[a] == 0:
        i = 1
        while True:
            if a*i > 10**6:
                break
            C[a*i] = 1
            i += 1
        if cnt[a] == 1:
            ans += 1

print(ans)
# Original solution
# Contest No.: ABC170
# Problem No.: D
# Solver:      JEMINI
# Date:        20200614

import sys
import heapq

def main():
    n = int(eval(input()))
    nums = list(map(int, sys.stdin.readline().split()))
    nums.sort()

    check = [False] * (10 ** 6 + 1)
    for i in range(1, n):
        if nums[i] == nums[i - 1]:
            check[nums[i]] = True

    ans = 0
    for i in range(n):
        if check[nums[i]] == False:
            ans += 1
        cnt = nums[i] * 2
        while cnt < 10 ** 6 + 1:
            check[cnt] = True
            cnt += nums[i]
    print(ans)

    
    return

if __name__ == "__main__":
    main()

# Optimized solution
# Contest No.: ABC170
# Problem No.: D
# Solver:      JEMINI
# Date:        20200614

import sys
import heapq

def main():
    n = int(eval(input()))
    nums = list(map(int, sys.stdin.readline().split()))
    nums.sort()

    check = [False] * (10 ** 6 + 1)
    for i in range(1, n):
        if nums[i] == nums[i - 1]:
            check[nums[i]] = True
    #print(nums)
    ans = 0
    for i in range(n):
        if check[nums[i]] == False:
            ans += 1
        if i == 0 or (i > 0 and nums[i] != nums[i - 1]):
            cnt = nums[i] * 2
            while cnt < 10 ** 6 + 1:
                #print(cnt)
                check[cnt] = True
                cnt += nums[i]
        #print(ans)
    print(ans)

    
    return

if __name__ == "__main__":
    main()
# Original solution
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    from collections import Counter

    n = int(readline())
    a = list(map(int, readline().split()))
    memo = [True] * (10 ** 6 + 1)
    ans = 0
    for k, v in sorted(Counter(a).items()):
        if v == 1 and memo[k]:
            ans += 1
        memo[k] = False
        for i in range(1, 10 ** 6 + 1):
            if 10 ** 6 + 1 <= i * k:
                break
            memo[i * k] = False
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort()
    limit = a[-1]
    dp = [0] * (limit + 1)
    for aa in a:
        dp[aa] += 1
        if dp[aa] == 1:
            for i in range(aa * 2, limit + 1, aa):
                dp[i] += 1
    print((sum((1 for aa in a if dp[aa] == 1))))


if __name__ == '__main__':
    main()
# Original solution
def main():
  N=int(eval(input()))
  D=[0]*(10**6+1)

  for a in sorted(map(int,input().split())):
    if D[a]==0:
      D[a]=1
      for i in range(2*a,10**6+1,a):
        D[i]=-1
    else:
      D[a]=-1

  print((D.count(1)))

main()


# Optimized solution
def main():
  N=int(eval(input()))
  D=[0]*(10**6+1)
  A=sorted(map(int,input().split()))
  m=max(A)+1

  for a in A:
    if D[a]==0:
      D[a]=1
      for i in range(2*a,m,a):
        D[i]=-1
    else:
      D[a]=-1

  print((D.count(1)))

main()
# Original solution
from collections import Counter 
N = int(eval(input()))
numbers = [int(i) for i in input().split()]

c = Counter(numbers)

divisors = sorted(set(numbers))
target_numbers = sorted([k for k, v in list(c.items()) if v == 1])

cnt = N - len(target_numbers)
for n in target_numbers:
    for d in divisors:
        if n == d:
            continue
        if n % d == 0:
            cnt += 1
            break
        if n /2 < d:
            break
            
print((N - cnt))

# Optimized solution
N = int(eval(input()))
numbers = [int(i) for i in input().split()]

d = set()
s = set()

for n in numbers:
    if n in s: 
        d.add(n)
    else :
        s.add(n) 

M = max(s) 

X = [1 for _ in range(M+1)] 

for a in s:
    if a in d:
        X[a] = 0 
    for i in range(2*a, M+1, a): 
        X[i] = 0
    
output = 0

for n in numbers:
    if X[n] == 1:
        output += 1
print(output)
# Original solution
import sys
n=int(eval(input()))
a=list(map(int,input().split()))

if n==1:
    print((1))
    sys.exit()
"""
def fsort(a,max):
    n=len(a)
    f=[0]*(max+1)
    b=[0]*n

    for i in range(n):
        f[a[i]]+=1
    for i in range(1, max+1):
        f[i]+=f[i-1]
    for i in range(n-1,-1,-1):
        f[a[i]]-=1; b[f[a[i]]]=a[i]
    for i in range(n):
        a[i]=b[i]

fsort(a, 10**6)
"""
def quicksort(a, left: int, right: int):
    #a[left]〜a[right]をクイックソート
    pl=left
    pr=right
    pivot= a[(left +right)//2]

    #print(f'a[{left}]~a[{right}] : ', *a[left : right +1])

    while pl<=pr:
        while a[pl] <pivot: pl+=1
        while a[pr] >pivot: pr-=1
        if pl <= pr:
            a[pl], a[pr]= a[pr], a[pl]
            pl+=1
            pr-=1

    if left < pr: quicksort(a, left, pr)
    if pl < right: quicksort(a, pl, right)

def quick_sort(a):
    quicksort(a, 0, len(a)-1)

quick_sort(a)
if a[0]==1:
    if a[1]==1:
        print((0))
        sys.exit()
    else:
        print((1))
        sys.exit()

if a[0]==a[1]:
    count=0
else:
    count=1

for i in range(n-2):
    if a[i+2]==a[i+1]:
        continue
    if a[i+1]==a[i]:
        continue
    for l in range(i+1):
        if a[i+1]%a[l]==0:
            break
        if i==l:
            count+=1

if a[n-1]!=a[n-2]:
    for i in range(n):
        if a[n-1]%a[i]==0:
            break
        if i==n-2:
            count+=1

print(count)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))

a.sort()
amx=max(a)+1
l=[True]*amx
ans=0

for i in range(n-1):
    if l[a[i]]:
        for j in range(a[i],amx,a[i]):
            l[j]=False
        if a[i]<a[i+1]:
            ans+=1

if l[-1]:
    ans+=1

print(ans)
# Original solution
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def resolve():
    readline=sys.stdin.readline
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    arr.sort()
    tb=[False]*(10**6 + 10)
    ans=0
    for i in range(n):
        flg=0
        x=arr[i]
        if tb[x]==False:
            flg=1
        if i < (n-1):
            if arr[i]==arr[i+1]:
                flg=0
        ans+=flg
        for j in range(x,10**6+5,x):
            tb[j]=True
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

# Optimized solution
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import collections

def resolve():
    readline=sys.stdin.readline
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    c=collections.Counter(arr)
    tb=[False]*(10**6 + 10)
    ans=0
    for x in list(c.keys()):
        for j in range(x*2,10**6+5,x):
            tb[j]=True
    for x in list(c.keys()):
        if tb[x]==0 and c[x]==1:
            ans+=1
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
# Original solution
def main():
    N = int(eval(input()))
    A = list(map(int,input().split()))
    A.sort()
    num_tmp = [0]*(A[-1]+1)

    for a in A:
        num_tmp[a] += 1
        if num_tmp[a] == 1:
            for i in range(2*a,max(A)+1,a):
                num_tmp[i] = 2

    print((num_tmp.count(1)))
    
main()

# Optimized solution
def main():
    N = int(eval(input()))
    A = list(map(int,input().split()))
    A.sort()
    MAX = A[-1]+1
    num_tmp = [0]*MAX

    for a in A:
        num_tmp[a] += 1
        if num_tmp[a] == 1:
            for i in range(2*a,MAX,a):
                num_tmp[i] = 2

    print((num_tmp.count(1)))
    
main()
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
d={}

for a in A:
    if a in d:
        d[a]+=1
    else:
        d[a]=1
        
if 1 in d:
    if d[1]==1:
        ans=1
    else:
        ans=0

else:
    ans=0
    m=min(A)
    for i in d:
        if d[i]>1 or (i!=m and i%m==0):
            continue
        p=1
        for j in range(2,int(i**0.5)+1):
            if i%j==0:
                if j in d or i//j in d:
                    p=0
                    break
        ans+=p

print(ans)

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
A.sort(reverse=True)
M=max(A)+1
table=[0 for _ in range(M)]

for i in range(N):
    if i>0 and A[i]==A[i-1]:
        table[A[i]]=0
        continue
    table[A[i]]=1
    for n in range(2,M):
        if A[i]*n>=M:
            break
        table[A[i]*n]=0
print((sum(table)))
# Original solution
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    A = LI()

    y = [0] * (10**6 + 1)
    for i in range(N):
        y[A[i]] += 1

    ans = 0
    for i in range(N):
        x = A[i]
        if x > 1:
            if y[1] : continue
        if y[x] > 1: continue

        f = 1
        for j in range(2,int(math.sqrt(x))+1):
            if x % j == 0 and (y[j] or y[x//j]):
                f = 0
                break
        ans += f

    print(ans)
if __name__ == '__main__':
    main()


# Optimized solution
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()

    y = [0] * (10**6 + 1)
    A = []
    for x in sys.stdin.readline().split():
        x = int(x)
        A.append(x)
        y[x] += 1

    ans = 0
    for i in range(N):
        x = A[i]
        if x > 1:
            if y[1] : continue
        if y[x] > 1: continue

        f = 1
        for j in range(2,int(math.sqrt(x))+1):
            if x % j == 0 and (y[j] or y[x//j]):
                f = 0
                break
        ans += f

    print(ans)
if __name__ == '__main__':
    main()
# Original solution
from bisect import bisect_left, bisect_right


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

def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    A.sort()
    ans = 0
    B = set(A)
    for a in B:
        flag = False
        left = bisect_left(A, a)
        right = bisect_right(A, a)

        if right-left > 1:
            continue

        divs = make_divisors(a)
        for d in divs:
            if d in B and d != a:
                flag = True
                break

        if flag == False:
            ans += 1
    
    print(ans)
    
if __name__ == "__main__":
    main()

# Optimized solution
def solve(A):
    n = A[-1]
    is_nodiv = [True for _ in range(n+1)]

    pre = 0
    for a in A:
        if pre == a or not is_nodiv[a]:
            is_nodiv[a] = False
            continue

        for j in range(2*a, n+1, a):
            is_nodiv[j] = False
        
        pre = a
        
    return sum([is_nodiv[a] for a in A])



def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    A.sort()
    ans = solve(A)
    print(ans)

if __name__ == "__main__":
    main()
# Original solution
def solve(A):
    n = A[-1]
    is_nodiv = [True for _ in range(n+1)]

    pre = 0
    for a in A:
        if pre == a or not is_nodiv[a]:
            is_nodiv[a] = False
            continue

        for j in range(2*a, n+1, a):
            is_nodiv[j] = False
        
        pre = a
        
    return sum([is_nodiv[a] for a in A])



def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    A.sort()
    ans = solve(A)
    print(ans)

if __name__ == "__main__":
    main()


# Optimized solution
def solve(A):
    n = A[-1]
    is_nodiv = [True] * (n+1)

    pre = 0
    for a in A:
        if pre == a or not is_nodiv[a]:
            is_nodiv[a] = False
            continue

        for j in range(2*a, n+1, a):
            is_nodiv[j] = False
        
        pre = a

    return sum([is_nodiv[a] for a in A])



def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    A.sort()
    ans = solve(A)
    print(ans)

if __name__ == "__main__":
    main()