using static System.Math; using System; public class Hello { static void Main() { var n = long.Parse(Console.ReadLine().Trim()); var n2 = n * n; getAns(n2); } static void getAns(long t) { var count = 0; for (long i = 1; i * i <= t; i++) { var s = (long)Sqrt(t - i * i); if (s != 0 && i * i + s * s == t) count++; else if (s + 1 != 0 && i * i + (s + 1) * (s + 1) == t) count++; else if (s - 1 != 0 && i * i + (s - 1) * (s - 1) == t) count++; } Console.WriteLine(count); } }