import Data.List

solve :: Int ->	Bool
solve 2	= True
solve n = and [ if 0 == mod n x then False else True | x <- [2..root n]]
  where root = ceiling . sqrt . fromIntegral

main = getContents >>= print . length . elemIndices True . map solve . tail . map read . words