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)

import qualified Data.Map as M

primes :: [Int]
primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]

revPower :: Int -> Int -> Int
revPower n d = fst $ helper (0, n)
  where helper (i, n') = if n' `mod` d == 0
                         then helper (i + 1, n' `div` d)
                         else (i, n')

factoring :: Int -> M.Map Int Int
factoring n = M.fromList $ map (\p -> (p, revPower n p)) primes

merge :: (Ord k, Num a) => M.Map k a -> M.Map k a -> M.Map k a
merge  = M.intersectionWith (+)

values :: M.Map k a -> [a]
values = fmap snd . M.assocs

count :: [Int] -> Int
count fs = 
  let g2s = length $ filter (2 <=) fs
      g4s = length $ filter (4 <=) fs
      g14s = length $ filter (14 <=) fs
      g24s = length $ filter (24 <=) fs
      g74s = length $ filter (74 <=) fs
  in g74s +
     g24s * (g2s - 1) +
     g14s * (g4s - 1) +
     g4s * (g4s - 1) * (g2s - 2) `div` 2

main = do
  n <- read <$> getLine :: IO Int
  let fs = values . foldr1 merge $ map factoring [1..n]
  print $ count fs