Plus Minus Four Squares
문제
Every non-negative integer may be written as the sum of the squares of four integers:
By allowing subtraction, may be written in many more ways; in fact infinitely many.
In this problem you will count the number of different ways to express an input as a sum or difference of four squares with several restrictions:
First, we need to decide what different means.
Any of , , , may be replaced by its negative. We do not want to count these as different so we will only count different squared values.
Reordering , , , does not give a different representation.
So, we define a plus minus four square representation of a non-negative integer as a sequence of four perfect squares in non-increasing order with plus or minus signs whose computation results in .
In addition, we add the following restrictions:
- The first square must be no more than to avoid having infinitely many representations.
- If the same square appears multiple times all appearances must be preceded by (a possibly implicit) plus sign or all must be preceded by a minus sign. This avoids something like:
- A square of zero must be preceded by a plus sign.
For example, the only sums of squares which add to 64 are:
If we allow minus signs with the above additional restrictions we have the following which each sum up to :
Write a program which takes as input a non-negative integer and outputs a count of the number of different four square plus minus representations of .
입력
Input consists of one line containing a single non-negative decimal integer (0 < n ≤ 5000).
출력
There is one line of output that consists of a single decimal integer giving a count of the number of different four square plus minus representations of .
예제
예제 1
64
12
예제 2
65
10
예제 3
2023
245