using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var x = NN; var minlist = new List<(int min, int sum)>(); var mindic = new List[301]; for (var i = 0; i < mindic.Length; ++i) mindic[i] = new List(); var maxlist = new List<(int max, int sum)>(); var maxdic = new List[301]; for (var i = 0; i < maxdic.Length; ++i) maxdic[i] = new List(); for (var i = 0; i <= 300; ++i) for (var j = i; j <= 300; ++j) for (var k = j; k <= 300; ++k) { var sum = i * i * i + j * j * j + k * k * k; if (sum > x) { break; } mindic[i].Add(sum); maxdic[k].Add(sum); } var dic = new Dictionary(); var ans = 0L; for (var i = 0; i < mindic.Length; ++i) { foreach (var s in maxdic[i]) { if (dic.ContainsKey(s)) ++dic[s]; else dic[s] = 1; } foreach (var m in mindic[i]) { if (dic.ContainsKey(x - m)) ans += dic[x - m]; } } WriteLine(ans); } }