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, FlexibleContexts #-}

import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Array
import Data.Array.ST
import Data.List
import Debug.Trace (traceShow, traceShowM)
import qualified Data.IntMap.Strict as IM

-- 素数判定
isPrime :: Int -> Bool
isPrime n = all ((/= 0) . (n `mod`)) $ takeWhile ((<= n) . (^ 2)) (primes n)

-- n以下の素数
primes :: Int -> [Int]
primes n = 2 : 3 : filter isPrime xs
  where
    xs = takeWhile (<= n) [6 * i + j | i <- [1 ..], j <- [-1, 1]]

-- 素因数分解
primeFactor :: Int -> IM.IntMap Int
primeFactor n = go IM.empty n $ takeWhile ((<= n) . (^ 2)) (primes n)
  where
    go im 1  _  = im
    go im !k [] = IM.insertWith (+) k 1 im
    go im !k (p:ps)
        | r == 0    = go (IM.insertWith (+) p 1 im) q (p:ps)
        | otherwise = go im k ps
      where
        (q, r) = k `divMod` p

-- 約数の列挙
divisor :: Int -> [Int]
divisor n = foldr f [] $ takeWhile ((<= n) . (^ 2)) [1 .. n]
  where
    f x ds
        | r == 0, q /= x = x : q : ds
        | r == 0         = x : ds
        | otherwise      = ds
      where
        (q, r) = n `divMod` x

----------------------------------------

gen :: Int -> IM.IntMap Int
gen n = foldr (IM.unionWith (+)) IM.empty $ fmap primeFactor [2 .. n]

gen2 :: Int -> [Int]
gen2 n = IM.elems $ gen n

gen3 :: Int -> [Int]
gen3 n = filter (>= 3) $ fmap (+ 1) $ gen2 n

gen4 :: Int -> [[Int]]
gen4 n = do
    x <- gen3 n
    let ys = filter (<= x) $ fmap product $ sequence [[1,3],[1,5,25]]
    return ys

solve :: Int -> Int
solve n = length $ filter (== 75) $ fmap product $ sequence $ gen4 n

main :: IO ()
main = do
    n <- readLn :: IO Int
    print $ solve n
    return ()