Problem:
Score : 400 points

Problem Statement

You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many Shichi-Go numbers (literally "Seven-Five numbers") are there?

Here, a Shichi-Go number is a positive integer that has exactly 75 divisors.

Note

When a positive integer A divides a positive integer B, A is said to a divisor of B.
For example, 6 has four divisors: 1, 2, 3 and 6.

Constraints

1 \leq N \leq 100

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of the Shichi-Go numbers that are divisors of N!.

Sample Input 1

9

Sample Output 1

0

There are no Shichi-Go numbers among the divisors of 9! = 1 \times 2 \times ... \times 9 = 362880.

Sample Input 2

10

Sample Output 2

1

There is one Shichi-Go number among the divisors of 10! = 3628800: 32400.

Sample Input 3

100

Sample Output 3

543

Solution in Haskell (GHC 7.10.3) (judge verdict: Accepted)

{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad
-- import Control.Monad.ST
-- import Debug.Trace

solve :: Int -> Int
solve n | n <= 9 = 0
        | otherwise = ((fm 4) * ((fm 4) - 1) `div` 2) * ((fm 2) - 2)
                      + (fm 14) * ((fm 4) - 1)
                      + (fm 24) * ((fm 2) - 1)
                      + (fm 74)
  where

  pvec = VU.toList $ VU.create $ do
    v <- VUM.replicate 101 0
    forM_ [2..n] $ \k -> do
      forM_ (prfac k) $ \(p,r) -> VUM.modify v (+ r) p
    return v

  fm :: Int -> Int
  fm k = length (filter (>= k) pvec)

sieve :: [Int]
sieve = 2 : sieve_sub [2] [3..]

sieve_sub :: [Int] -> [Int] -> [Int]
sieve_sub (n:yet) cand =
  let
    (cnfmd, rem) = span (< n*n) cand
    newcand = filter (\i -> i `mod` n /= 0) rem
  in cnfmd ++ sieve_sub (yet ++ cnfmd) newcand

-- prfac : prime factorization

prfac :: Int -> [(Int,Int)]
prfac n = filter ((>= 1) . snd) $ unfoldr f (sieve, n)
  where
    f (_, 1) = Nothing
    f (p:ps, k) | p*p > k   = Just ((k, 1), ([], 1))
                | otherwise = Just ((p, pow), (ps, div k p_pow))
      where (pow, p_pow) = divmany k p
    divmany k p = sub 0 1 k
      where sub pow p_pow x | m == 0    = sub (pow+1) (p_pow*p) d
                            | otherwise = (pow, p_pow)
              where (d,m) = divMod x p

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Int
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n]:remLines1 = remLines0
      n = readBInt bs_n
  in solve n

outAnswer :: Int -> IO ()
outAnswer = putStrLn . show

main :: IO ()
main = outAnswer . tmain =<< B.getContents