You have been hired as the Royal Architect to construct a Perfect Portal. To maintain dimensional stability, every portal requires exactly three magical power crystals arranged in a perfect right-angled triangle.
The King has handed you a highly unstable core crystal of length N. To stabilize it, you must find two other crystals of positive integer lengths such that the three crystals form a right-angled triangle. The core crystal N can act as either one of the shorter legs or as the longest side (the hypotenuse).
The King doesn't just want one solution—he wants to know his options. Your task is to calculate the total number of distinct configurations of crystals that can stabilize the core. Two configurations are considered distinct if the set of the three crystal lengths is different.
Input
The first and only line of input contains a single integer N, representing the length of the core crystal (1 \le N \le 10^{6}).
Output
Print a single integer: the total number of distinct sets of two positive integers \{x, y\} such that the three side lengths \{N, x, y\} form a right-angled triangle.
Examples
| standard input | standard output |
|---|
| 15
| 5
|
Note
Explanation for the test case:
The valid triplets containing 15 are \{8, 15, 17\}, \{9, 12, 15\}, \{15, 20, 25\}, \{15, 36, 39\}, and \{15, 112, 113\}.