Problem:
Score : 400 points

Problem Statement

Given is a number sequence A of length N.

Find the number of integers i \left(1 \leq i \leq N\right) with the following property:

For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Constraints

All values in input are integers.

1 \leq N \leq 2 \times 10^5

1 \leq A_i \leq 10^6

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \cdots A_N

Output

Print the answer.

Sample Input 1

5
24 11 8 3 16

Sample Output 1

3

The integers with the property are 2, 3, and 4.

Sample Input 2

4
5 5 5 5

Sample Output 2

0

Note that there can be multiple equal numbers.

Sample Input 3

10
33 18 45 28 8 19 89 86 2 4

Sample Output 3

5

Solution in Fortran (GNU Fortran 9.2.1) (judge verdict: Accepted)

      MODULE divisorMod
! 約数列挙のためのモジュール
      IMPLICIT NONE
      
      integer,parameter,private :: prec = 8
      
      contains
! 引数Nの約数全て(1-N)を割り付け配列で返す関数．
! N>=1のみ．
! O( sqrt(N) )
      function allDivisor( N ) result( resArray )
        implicit none
        integer(prec),intent(in) :: N
        integer(prec),allocatable :: resArray(:),buffer(:)
        integer(prec) :: i,c
        
        if( N<=0 )then !error
          resArray = [0]
          return
        end if
        
        
        allocate( buffer(floor(sqrt(real(N)))*2) )
        
        !c : counter
        c = 1
        do i = 1,floor(sqrt(real(N+1)))
          if( mod(N,i)==0 )then
            buffer(c) = i
            c = c + 1
          end if
        end do
        
        !c is allways over 1
        c = c - 1
        
        
        if( buffer(c)*buffer(c)==N )then
          !n is Square number
          buffer(c:2*c-1) = N / buffer(c:1:-1)
          c = 2*c - 1
        else
          buffer(c+1:2*c) = N / buffer(c:1:-1)
          c = 2*c
        end if
        
        !c is now number of divisor
        allocate( resArray(1:c) )
        resArray(1:c) = buffer(1:c)
      end function allDivisor
      END MODULE divisorMod
      
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      PROGRAM NotDivisible
      use divisorMod
      IMPLICIT NONE
      INTEGER,PARAMETER :: prec = 8
      integer(prec) :: n, ans=0
      integer(prec), allocatable :: a(:)
      integer(prec) :: i,j
      integer(prec) :: list(10**6) = 0
      integer(prec) ,allocatable :: div(:)
      
      
      read*,n
      allocate( a(n) )
      read*,a(1:n)
      
      
      do i = 1,n
        list( a(i) ) = list( a(i) ) + 1
      end do
      
      
      
      outer:&
      do i = 1,n
        div = allDivisor( a(i) )
       ! print'(*(x,i0))',div(:)
        
        do j = 1,size(div)-1
          if( list(div(j))/=0 )then
            cycle outer
          end if
        end do
        
        if( list(a(i))>=2 )then
          cycle outer
        end if
        
        ans = ans + 1
        deallocate( div )
      end do outer
      
      print*,ans
      
      
     ! stop
      !debugg
      
      
      
      END PROGRAM