The Pythagorean theorem describes the relationship among the three sides of a right triangle. If the hypotenuse has length $C$ and the other two sides have lengths $A$ and $B$, then
$$A^2 + B^2 = C^2$$
Among right triangles whose three side lengths are all natural numbers, the best known one is the triangle with sides $3$, $4$, and $5$. For example, when $A = 12$ there are exactly two such right triangles.
Given a natural number $A$, how many natural numbers $B$ with $B > A$ are there such that the hypotenuse length $C$ is also a natural number?
The input consists of several test cases. Each test case is given on a single line as one natural number $A$ ($2 \le A < 2^{20}$). The last line of the input contains a single $0$, which is not processed.
For each test case, print on its own line the number of natural numbers $B$ (with $B > A$) that form a right triangle whose hypotenuse length is a natural number.