import bisect ls = [[] for i in range(333)] for i in range(1, 4444): x = i ** 3 ls[x%333].append(x*i) lim = 4444 ** 4 ans = 0 a = int(input()) e3 = [i**3 for i in range(4445)] e4 = [i**4 for i in range(4445)] for i in range(1, 4444): s3 = e3[i] + e3[i] k = (a - s3) % 333 s4 = e4[i] + e4[i] cnt = bisect.bisect_right(ls[k], lim-s4) - bisect.bisect_left(ls[k], e4[i]) cnt = max(cnt, 0) ans += cnt * 3 if (e3[i] * 3) % 333 == a and (e4[i] * 3) <= lim: ans -= 2 for j in range(i+1, 4444): s3 = e3[i] + e3[j] k = (a - s3) % 333 s4 = e4[i] + e4[j] cnt = bisect.bisect_right(ls[k], lim-s4) - bisect.bisect_left(ls[k], e4[j]) cnt = max(cnt, 0) ans += cnt * 6 if (e3[i] + e3[j] * 2) % 333 == a and (e4[i] + e4[j] * 2) <= lim: ans -= 3 print(ans)