import Data.List
import qualified Data.Set as S

main = interact $ show . sol . read

sol :: Int -> Int
sol = sum . map (f . length) . group . pf

f n = truncate $ sqrt (2*fromIntegral n+0.25)-0.5

pf 1 = []
pf n = factor n primes

factor n (p:ps) 
  | p*p > n      = [n]
  | n `mod` p==0 = p:factor (n `div` p) (p:ps)
  | otherwise    = factor n ps 

primes = 2:sieve [3,5..]
  where
  sieve (x:xs) = x:f xs (g x xs S.empty)
  f (x:xs) tbl
    | c == x    = f xs (h x tbl)
    | otherwise = x:f xs (g x xs tbl)
    where 
    c = fst $ S.findMin tbl
  h x tbl
    | n == x    = h x (S.insert (n',ns') tbl')
    | otherwise = tbl
    where
    Just ((n,n':ns'), tbl') = S.minView tbl
  g p xs = S.insert (p*p, map (*p) xs)