#Lutece1391. LRZ and Ellipses

LRZ and Ellipses

Migrated from Lutece 1391 LRZ and Ellipses

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Recently, the beauty of the mathematics fetched LRZ completely. Today, LRZ construct an ellipse E0E_0 with function x2+4y2=4a2x^2+4y^2=4a^2. Now she find that she can rotate this ellipse by tt (t(0,90)t\in (0, 90))degrees counterclockwise around the original point O(0,0)O(0,0) to get a new ellipse E1E_1.

You can understand this action as the following picture:

title

LRZ define cc as the length of the segment of OCOC and bb as the length of the segment of OBOB

CC is the point of the intersection of E0E_0 and E1E_1 in the first quadrant.

BB is the point of the intersection of E0E_0 and E1E_1 in the second quadrant.

For an integer aa, if LRZ can find an angle t(0,90)t\in (0,90), so that bb and cc are also integers, she will call the triple (a,b,c)(a,b,c) a lucky triple.

Now LRZ is wondering, how many distinct lucky triples are there for aa from 1 to NN(inclusive).

For some stupid reasons we can regard triple (a,b,c)(a,b,c) and triple (a,c,b)(a,c,b) as the same triple.

1N10000000001\le N\le 1000000000

Input

An integer NN

Output

You should output the number of lucky triples.

Samples

1000
7

Resources

IEEEXTREME Programming Competition