getCombinations :: Integral a => a -> Int getCombinations l0 = length cs where l1 = div l0 4 l2 = ceiling $ sqrt $ fromIntegral l1 cs = [(m, n) | m <- [1 .. l2], n <- [1 .. m - 1], gcd m n == 1, odd $ m - n, 2 * m * (m + n) <= l1] main :: IO () main = print . getCombinations =<< readLn