SQUAREV1 - Revenge of the squares (variation)

Given a number N calculate the number R of different presentations of N in the form A*A+B*B with A and B being positive integers including zero. 1*1+2*2 and 2*2+1*1 are not different presentations. So for input 5 the output is 1.

Input

Fifty tests with one positive integer < 10^9.

Output

Print the illustrated above number R for each test.

Example

Input:
5
7
986244509 Output: 1
0
2

Added by:HWK
Date:2011-02-28
Time limit:1s
Source limit:300B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2011-04-20 10:51:36 Virgo
how about 2? 2 = 1*1 + 1*1 so the result may be 1
2011-04-04 18:05:41 Gurpreet Singh
In my opinion , if you want to reduce the source limit reduce it to 150 or so and move the problem to challenge...
2011-03-18 13:45:23 numerix
My opinion: Problem should stay in classical. Source limit may be set higher, but as there are other classical problems with tight source limit, there is no need to do so.
2011-03-18 12:55:51 HWK
Should I? Or should I remove the source limit?
2011-03-18 06:34:10 :(){ :|: & };:

Since you are imposing source limit,how about moving this to challenge? :-)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.