Unique right triangle

No attempts yetTime limit1sMemory limit256 MB

Problem

12cm is the shortest length of string that can be bent into a right triangle whose three sides are all integers. Here are a few more such lengths.

  • 12cm: (3, 4, 5)
  • 24cm: (6, 8, 10)
  • 30cm: (5, 12, 13)
  • 36cm: (9, 12, 15)
  • 40cm: (8, 15, 17)
  • 48cm: (12, 16, 20)

A string of length 20cm cannot be bent into a right triangle with integer sides in any way.

Some lengths give several different right triangles. For example, 120cm gives three.

  • 120cm: (30, 40, 50), (20, 48, 52), (24, 45, 51)

Let LL be the length of the string. Among the values LNL \le N, how many give exactly one right triangle with integer sides? Triangles that differ only in the order of the sides count as the same triangle.

Input

The input holds several tests. Each line has one integer NN, and the tests continue to the end of the input. (1N200000001 \le N \le 20\,000\,000)

Output

For each test, print on its own line the number of values LNL \le N that give exactly one right triangle with integer sides.