#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int N = 300; vector V[N+1]; void solve() { int X;cin >> X; vector>>> A; for(int i = 0;i <= N;i++)for(int j = i;j <= N;j++)for(int k = j;k <= N;k++) A.push_back(make_pair(i*i*i+j*j*j+k*k*k,make_pair(i,make_pair(j,k)))); sort(A.begin(),A.end()); vector>>> B(A.rbegin(),A.rend()); long long ans = 0; int bi = 0; unordered_set S; for(int i = 0;i < (int)A.size();i++) { while(bi < (int)B.size() && A[i].first+B[bi].first > X) bi++; if(bi == (int)B.size() || B[bi].first < A[i].first) break; if(bi < (int)B.size() && A[i].first+B[bi].first == X) { vector v; v.push_back(A[i].second.first); v.push_back(A[i].second.second.first); v.push_back(A[i].second.second.second); v.push_back(B[bi].second.first); v.push_back(B[bi].second.second.first); v.push_back(B[bi].second.second.second); sort(v.begin(),v.end()); long long val = 0; for(int j = 0;j < 6;j++) val = val*(N+1) + v[j]; if(S.count(val)); else ans++,S.insert(val); //cout << A[i] << " " << B[bi] << endl; } } cout << ans << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; //cin >> tt; while(tt--) solve(); }