#P2508. Counting Lattice Points on a Circle

    ID: 15778 Type: Default 1000ms 256MiB

Counting Lattice Points on a Circle

Counting Lattice Points on a Circle

Given a circle defined by the equation \(x^2+y^2=r^2\), count the number of points on its circumference that have integer coordinates. In other words, find the number of integer solutions \((x, y)\) that satisfy the equation.

Note: When \(r=0\), the only point is \((0,0)\).

inputFormat

The input consists of a single integer \(r\) (where \(r \geq 0\)) representing the radius of the circle defined by \(x^2+y^2=r^2\).

It is guaranteed that \(r\) is a non-negative integer.

outputFormat

Output a single integer representing the number of points with integer coordinates that lie on the circumference of the circle.

sample

0
1