P2508 [HAOI2008] Lattice Points on a Circle

Description

Given the circle $(x^2+y^2=r^2)$, determine how many points on its circumference have integer coordinates.

Input Format

A single integer $r$.

Output Format

The number of lattice points.

Explanation/Hint

Constraints: $r\leq 2000 000 000$. Translated by ChatGPT 5