Module: Linear enumeration


Problem

3 /5


Belvita and Pythagorean triples

Problem

Today Belvita learned about Pythagorean triples. If you suddenly didn’t know, then this is a triple of integers (a, b, c) such that you can form a right triangle with the lengths of the first leg, second leg and hypotenuse equal to a, b and c, respectively. More formally, it must hold that a2 + b2 = c2.
In the evening she decided to look for existing Pythagorean triples, but she forgot the formula. In the end, instead of the correct criterion, she used the following: c = a2 - b.
Soon Belvita recognized the mistake, but according to her criterion, such triples of numbers were found that they really were Pythagorean.
This interested Belvita and she decided to count the number of triples of integers (a, b, c) such that  1 <= a, b, c <= n and they fit both the real Pythagorean triple formula and the erroneous one.
Do the math.

Input:
The first line contains a single integer n (1 <= n <= 109)

Output:
Print one number - the number of triples of integers (a, b, c) such that they meet both criteria.

Examples:
 
Input Output
3 0
9 1