from collections import defaultdict X = int(input()) half = X//2 half2 = X//2+X%2 A = [] cntC = [0]*301 for c in range(301): for b in range(c+1): for a in range(b+1): if a*a*a+b*b*b+c*c*c <= half: A.append(a*a*a+b*b*b+c*c*c) cntC[c] += 1 B = [] cntD = [0]*301 for d in range(301): for e in range(d, 301): for f in range(e, 301): if half2 <= d*d*d+e*e*e+f*f*f <= X: B.append(d*d*d+e*e*e+f*f*f) cntD[d] += 1 if len(A) >= len(B): D = defaultdict(int) idx = len(B)-1 idxA = 300 while 0 <= idxA and cntC[idxA] == 0: idxA -= 1 idxB = 300 while 0 <= idxB and cntD[idxB] == 0: idxB -= 1 ans = 0 for s in A[::-1]: while 0 <= idx and idxA <= idxB: D[B[idx]] += 1 cntD[idxB] -= 1 while 0 <= idxB and cntD[idxB] == 0: idxB -= 1 idx -= 1 ans += D[X-s] cntC[idxA] -= 1 while 0 <= idxA and cntC[idxA] == 0: idxA -= 1 else: D = defaultdict(int) idx = len(A)-1 idxA = 300 while 0 <= idxA and cntC[idxA] == 0: idxA -= 1 idxB = 300 while 0 <= idxB and cntD[idxB] == 0: idxB -= 1 ans = 0 for s in B[::-1]: while 0 <= idx and idxA <= idxB: D[A[idx]] += 1 cntC[idxA] -= 1 while 0 <= idxA and cntC[idxA] == 0: idxA -= 1 idx -= 1 ans += D[X-s] cntD[idxB] -= 1 while 0 <= idxB and cntD[idxB] == 0: idxB -= 1 print(ans)