#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int X; cin >> X; vector C(301); vector> abc; for(int i=0; i<301; i++) C.at(i) = i*i*i; for(int a=0; a<=300; a++) for(int b=a; b<=300; b++) for(int c=b; c<=300; c++){ int cube = C.at(a)+C.at(b)+C.at(c); abc.push_back({cube,a,b,c}); } sort(abc.begin(),abc.end()); int answer = 0; int l = 0,r = abc.size()-1; while(l < abc.size()){ auto &[cube1,a1,b1,c1] = abc.at(l); if(cube1 > X) break; l++; while(r >= 0){ auto &[cube2,a2,b2,c2] = abc.at(r); if(cube1+cube2 > X) r--; else break; } auto &[cube2,a2,b2,c2] = abc.at(r); if(cube1+cube2 != X) continue; int rl = r; while(true){ auto &[cube3,a3,b3,c3] = abc.at(rl); if(cube2 == cube3) rl--; else{rl++; break;} if(rl < 0){rl++; break;} } for(int i=rl; i<=r; i++){ auto &[cube3,a3,b3,c3] = abc.at(i); if(c1 <= a3) answer++; } } cout << answer << endl; }