main = interact $ (flip (++) "\n") . show . length . filter prime . (\(x:ys) -> take x ys) . map read . lines

primes50 = filter (\x -> (x == 2 || odd x) && null [y | y <- [2..100], y /= x, rem x y == 0]) [2..100]

twoOrOdd x = (x == 2 || odd x)
no50Dividing x = null [y | y <- primes50, rem x y == 0]
noDivisors x = null [z | z <- [3..((ceiling . sqrt . fromIntegral) x)], (rem (z - 1) 6 == 0 || (rem (z + 1) 6 == 0)), rem x z == 0]

prime x = (elem x primes50) || (twoOrOdd x && no50Dividing x && noDivisors x)