      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 = 2,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