Yaroslav, Andrey and Roman love playing cubes. Sometimes they get together and play cubes for hours and hours! Today they got together again and they are playing cubes. Yaroslav took unit cubes and composed them into an a × a × a cube, Andrey made a b × b × b cube and Roman made a c × c × c cube. After that the game was finished and the guys left. But later, Vitaly entered the room. He saw the cubes and wanted to make a cube as well. But what size should the cube be? Of course it should be a large cube with the side of length a + b + c. Besides, Vitaly decided to decompose the cubes built by Yaroslav, Andrey and Roman and compose his own large cube out of them. However, it turned out that the unit cubes he got from destroying the three cubes just weren't enough to make a large cube. We know that Vitaly was short of exactly n cubes. Vitaly got upset, demolished everything and left. As he was leaving, he met Petya and told him that there had been three cubes in the room and that he needed another n unit cubes to make his own large cube.Petya entered the room and saw the messily scattered cubes. He wanted to make it neat and orderly again. But he only knows that there had been three cubes, made of small unit cubes and that Vitaly needed n more unit cubes to make a large one! Help Petya understand, how many ways of sizes a, b, c are there to restore Yaroslav's, Andrey's and Roman's cubes.

The single line of the input contains integer n (1 ≤ n ≤ 1014). We know that all numbers a, b, c are positive integers. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

In the single line print the required number of ways. If it turns out that there isn't a single way of suitable sizes of a, b, c, print 0.

#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <cmath>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-7
#define maxm 200000000
#define MAXN 33
#define inf 1000000000
//const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi 3.1415926535
using namespace std;
__int64 a[1000000];
int l;
void get(__int64 n)
{
      __int64 k=(__int64)sqrt((double)n);
      __int64 i;
      l=0;
      for (i=2;i<=k;i++)
      {
          if (n%i==0)
          {
              a[l++]=i;
          }
      }
}
int main()
{
    //freopen("E:\\in.txt","r",stdin);
    //freopen("E:\\out.txt","w",stdout);
    __int64 n;
   while(scanf("%I64d",&n)!=EOF)
   {
    if (n%3)
    {
        printf("0\n");
        continue;
    }
    n/=3;
    get(n);
    //printf("%d\n",l);
    __int64 x,y,z;
     int i,j;
     int ans=0;
     for (i=0;i<l;i++)
     {
         for (j=i;j<l;j++)
         {
            x=a[i];
            y=a[j];
            z=n/x;
            if(z%a[j]) continue;
            z/=a[j];
            if(z<y) break;
            if((x+y-z)<=0||(x+y-z)%2==1) continue;
            if((x+z-y)<=0||(x+z-y)%2==1) continue;
            if((z+y-x)<=0||(y+z-x)%2==1) continue;
            //if(n==1260/3) printf("%I64d %I64d %I64d\n",x,y,z);
            if(a[i]==a[j]&&a[i]==z)
            ans++;
            else if(x==y||x==z||y==z)
            {
                 ans+=3;
            }
            else ans+=6;
         }
     }
     printf("%d\n",ans);
   }
    return 0;
}

#include <iostream>
#include <stdint.h>
#include <vector>

using namespace std;

typedef int64_t ll;

inline ll readLong() { ll a; cin >> a; return a; }

inline char getWays(const ll x, const ll y, const ll z)
{
                ll w = (z - x + y);
		ll d = w >> 1LL;

		ll a = x - y + d;
		ll b = y - d;
		ll c = d;

		return ((w & 1) == 0 && a > 0 && b > 0 && c > 0 && a + b == x && b + c == y && a + c == z) ? 1 : 0;
}

int main() {
	ll n = readLong();

	if(n % 3 != 0) {
		cout << "0" << endl;
		return 0;
	}

	n /= 3;

	vector < ll > factors;

	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			factors.push_back(i);
		}
	}

	ll res = 0;

	for(size_t i = 0; i < factors.size(); i++) {
		for(size_t j = 0; j < factors.size(); j++) {
			ll x = factors[i], y = factors[j];

			if(n % (x * y) != 0)
				continue;

			ll z = n / (x * y);

			res += getWays(x, y, z);
		}
	}

	cout << res << endl;

	return 0;
}

#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
long long n;
long long x[10000111],X=0;
long long ans=0;
int main()
{
    long long i,j,k;
    long long p,q,r;
    long long t,tt,ttt;
    long long A,B,C;
    scanf("%I64d",&n);
    if(n%3!=0){printf("0");return 0;}
    n/=3;
    for(i=2;i*i<=n;i++)
     {
       if(n%i==0)
        {
          x[X]=i;
          X++;
        }
     }
    //for(i=0;i<X;i++)printf("%I64d ",x[i]);printf("\n");
    for(i=0;i<X;i++)
     {
       for(j=i;j<X;j++)
        {
          A=x[i];
          B=x[j];
          t=A*B;
          C=n/t;
          if(C*t!=n)continue ;
          if((A+B+C)&1) continue;
          if(A+B<=C) continue;
          if(C<B)continue;
        //  printf("%I64d %I64d %I64d\n",A,B,C);
          if(A==B and B==C)ans++;
          else if(A==B or B==C)ans+=3;
          else ans+=6;
        }
     }
    printf("%I64d",ans);

    scanf(" ");
    return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <ctime>

using namespace std;

void Solve();

int main()
{
	Solve();
}
/********************************it ends here*******************************/

typedef long long LL;
LL n;
int a[10000010], cnt;

inline bool check(int x, int y, int z)
{
	if (x + y <= z)
		return 0;
	if (x + z <= y)
		return 0;
	if (y + z <= x)
		return 0;
	return 1;
}

void Solve()
{
	cin >> n;
	if (n % 3) {
		cout << 0 << endl;
		return ;
	}
	n /= 3;
	int bnd = int(sqrt(n));
	for (int i = 1; i <= bnd; ++i)
		if (n % i == 0)
			a[++cnt] = i;

	LL ans = 0;
	for (int i = 1; i <= cnt; ++i) {
		LL t = n / a[i];
		for (int j = i; j <= cnt; ++j) {
			LL z = t / a[j];
			if (z * a[j] != t) continue;
			if (z < a[j])
				break;
			if (a[i] + a[j] + z & 1)
				continue;
			if (!check(a[i], a[j], z))
				continue;
			if (a[i] == a[j]) {
				if (a[j] == z)
					++ans;
				else ans += 3;
			}
			else if (a[j] == z)
				ans += 3;
			else ans += 6;
		}
	}
	cout << ans << endl;

}

#include <bits/stdc++.h>
#define LL long long
#define N 100010
using namespace std;
LL n, d[N];

int main(){
  cin >> n;
  if (n % 3) {
    puts("0");
    return 0;
  }
  LL ret = 0;
  n /= 3;
  int js = 0;
  for (LL i = 1; i * i <= n; ++ i) if (n % i == 0)  d[js++] = i;
  for (int i = 0; i < js; ++ i)
    for (int j = 0; j < js; ++ j){
      LL a = d[i], b = d[j], c = n / a / b;
      if (!(n % (a * b) || (a + b + c) % 2) && (a + b > c) && (a + c > b) && (b + c > a))
        ret++;
    }
  printf("%I64d\n", ret);
  return 0;
}

#pragma GCC optimize("O3")
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <class T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <class key, class value, class cmp = std::less<key>>
using ordered_map =
    tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

struct custom_hash {  // Credits: https://codeforces.com/blog/entry/62393
  static uint64_t splitmix64(uint64_t x) {
    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }

  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
  size_t operator()(pair<int64_t, int64_t> Y) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(Y.first * 31 + Y.second + FIXED_RANDOM);
  }
};

template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class T>
ostream& operator<<(ostream& os, unordered_set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class T>
ostream& operator<<(ostream& os, multiset<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class T>
ostream& operator<<(ostream& os, ordered_set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.first << ":" << m.second << ") ";
  return os << "}";
}
template <class L, class R, class chash = std::hash<R>>
ostream& operator<<(ostream& os, unordered_map<L, R, chash> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.first << ":" << m.second << ") ";
  return os << "}";
}
template <class L, class R, class chash = std::hash<R>>
ostream& operator<<(ostream& os, gp_hash_table<L, R, chash> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.first << ":" << m.second << ") ";
  return os << "}";
}

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline int64_t random_long(long long l, long long r) {
  uniform_int_distribution<int64_t> generator(l, r);
  return generator(rng);
}
inline int64_t random_long() {
  uniform_int_distribution<int64_t> generator(LLONG_MIN, LLONG_MAX);
  return generator(rng);
}

/////-----------------------------\\\\\

#define ll long long
#define LL long long
#define ld long double
#define all(v) v.begin(), v.end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define pii pair<ll, ll>
#define ppi pair<ll, pii>
#define pb push_back
#define S second
#define F first
#define die() return 0;

#define md 1000000007
#define fmd 998244353
#define M 30001
#define N 20

#define RBTTYPE int
#define ordered_set                                    \
  tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag, \
       tree_order_statistics_node_update>

// typedef __int128_t ull;
typedef unsigned long long ULL;
const long long Inf = 1e18 + 20;
const long long INF64 = 3e18;

ll mod = 1000000007;

inline int add(int x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline int sub(int x, int y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
inline int mul(int x, int y) { return (((long long)x) * y) % mod; }
inline int powr(int a, ll b) {
  int x = 1 % mod;
  while (b) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
T pw(T a, ll b) {
  T ans{1};
  while (b) {
    while (!(b & 1)) b >>= 1, a = (a * a);
    ans = (ans * a), --b;
  }
  return ans;
}
using ht = gp_hash_table<ll, ll, custom_hash>;
// Hashing

int _gen_base(const int before, const int after) {
  auto seed =
      std::chrono::high_resolution_clock::now().time_since_epoch().count();
  seed ^= ULL(new ULL);
  std::mt19937 mt_rand(seed);
  int base = std::uniform_int_distribution<int>(before + 1, after)(mt_rand);
  return base % 2 == 0 ? base - 1 : base;
}

int solve() {
  ll n, i, j, k, m, x, y, z;
  cin >> n;
  if (n % 3) {
    cout << "0\n";
    die();
  }
  n /= 3;
  ll ans = 0;
  vector<ll> fa;
  for (i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      fa.pb(i);
      if (n / i != i) {
        fa.pb(n / i);
      }
    }
  }
  sort(all(fa));
  for (ll x1 = 0; fa[x1] * fa[x1] * fa[x1] <= n; ++x1) {
    ll x = fa[x1];
    ll ml = sqrt(x * x + 4 * n / x) - x;
    ml /= 2;
    for (ll y = max(x, ml); x * y * y <= n; ++y) {
      if (n % (x * y)) continue;
      ll z = n / (x * y);

      ll s = (x + y + z);
      if (s % 2) {
        continue;
      }
      s /= 2;
      ll a = s - y, b = s - z, c = s - x;
      // trace(x, y, z);
      // trace(a, b, c);
      if (a >= 1 and b >= 1 and c >= 1) {
        ll mul = 6;
        if (a == b and b == c) {
          ans += 1;
        } else if (a == b || b == c || c == a) {
          ans += 3;
        } else {
          ans += 6;
        }
      }
    }
  }
  cout << ans << "\n";
  die();
}

void prec() {}
// #define FILE_INPUT

int main() {
#ifndef ONLINE_JUDGE
  double _tBeg = clock();
#endif
  // Use "set_name".max_load_factor(0.25);"set_name".reserve(512); with
  // unordered set unordered_map<long long, ll, custom_hash> safe_map;
  // gp_hash_table<long long, ll, custom_hash> safe_hash_table;

  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

#ifdef FILE_INPUT
  char* inputFile = "input.txt";
  char* outputFile = "output.txt";
  freopen(inputFile, "r", stdin);
  freopen(outputFile, "w", stdout);
#endif

  int t;
  t = 1;
  // prec();
  // cin >> t;

  int _case = 1;
  while (t--) {
    // cout<<"Case #"<<_case++<<": ";
    solve();
  }

#ifndef ONLINE_JUDGE
  double _tEnd = clock();
  // printf("\ntotal time %.6f\n", (_tEnd - _tBeg) / CLOCKS_PER_SEC);
#endif

  die();
}

#include <iostream>
#include <stdint.h>
#include <vector>

using namespace std;

typedef int64_t ll;

inline ll readLong() { ll a; cin >> a; return a; }

inline char getWays(const ll x, const ll y, const ll z)
{
		ll d = (z - x + y) / 2LL;

		ll a = x - y + d;
		ll b = y - d;
		ll c = d;

		return (a > 0 && b > 0 && c > 0 && a + b == x && b + c == y && a + c == z) ? 1 : 0;
}

int main() {
	ll n = readLong();

	if(n % 3 != 0) {
		cout << "0" << endl;
		return 0;
	}

	n /= 3;

	vector < ll > factors;

	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			factors.push_back(i);
		}
	}

	ll res = 0;

	for(size_t i = 0; i < factors.size(); i++) {
		for(size_t j = 0; j < factors.size(); j++) {
			ll x = factors[i], y = factors[j];

			if(n % (x * y) != 0)
				continue;

			ll z = n / (x * y);

			res += getWays(x, y, z);
		}
	}

	cout << res << endl;

	return 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long LL;

LL n, x, y, z, a, b, c;
vector <LL> d;

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);

#ifndef ONLINE_JUDGE
	freopen("e.in", "r", stdin);
	freopen("e.out", "w", stdout);
#endif
		cin >> n;
		if (n % 3){
			cout << 0;
			return 0;
		}
		n /= 3;
		for (LL i = 1; i * i <= n; i++){
			if (n % i == 0){
				d.push_back(i);
				if (i * i != n) d.push_back(n / i);
			}
		}
		int res = 0;
		sort(d.begin(), d.end());
		for (int i = 0; i < d.size() && d[i] * d[i] * d[i] <= n; i++){
			for (int j = i; j < d.size() && d[i] * d[j] * d[j] <= n; j++){
				x = d[i];
				y = d[j];
				if (n % (x * y) == 0){
					z = n / (x * y);
//					cout << x << " " << y << " " << z << "\n";
					a = x - z + y;
					b = z - y + x;
					c = y - x + z;
					if (a > 0 && b > 0 && c > 0 && a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
						a /= 2;	b /= 2;	c /= 2;
//						cout << a << " " << b << " " << c << "\n";
						if (a == b && b == c) res++;
						else{
							if (a == b || a == b || b == c) res += 3;
							else res += 6;
						}
					}
				}
			}
		}
		cout << res;

	return 0;

}

#include<iostream>
using namespace std;
#define LL long long
LL n,a[10000000],cnt,ans;
int main() {
	cin>>n;
	if(n%3) {cout<<0;return 0;}
	n/=3;
	for(LL i=1;i*i<=n;i++) if(n%i==0) a[++cnt]=i;
	for(int i=1;i<=cnt;i++)
		for(int j=cnt;j>=1;j--) {
			LL x=a[i],y=a[j],z=n/x/y;
			if(x*y*z!=n||((x+y+z)&1)||y>z) continue;
			if(x>y||x+y<=z||y+z<=x) break;
			if(x==y&&y==z) ans++;
			else if(x==y||y==z||x==z) ans+=3;
			else ans+=6;
		}
	cout<<ans<<endl;
	return 0;
}

#include <iostream>
#include <time.h>
#include <cmath>
#include <vector>
using namespace std;
typedef long long ll;
typedef double db;
int main()
{
    //freopen("1.txt","w",stdout);
    vector <ll> f;
ll rez,k1,k2,k3,k4,i,j,r,n,k,a,b,c,x,y,z;
cin>>n;
rez=0;
if (n%3!=0) {cout<<0;return 0;}
k=(ll)n/3;
for (i=2;i<=sqrt((db)k);i++)
if (k%i==0) f.push_back(i);
if (f.size())
for (i=f.size()-1;i>=0;i--)
if (f[i]*f[i]!=k) f.push_back(k/f[i]);
for (i=0;i<f.size();i++)
if (f[i]*f[i]*f[i]<=k)
{
x=f[i];
k1=k/x;
k3=sqrt((db)k1);
for (j=i;j<f.size();j++)
if (f[j]*f[j]<=k1&&k1%f[j]==0)
{
y=f[j];
z=k1/y;
ll a=(x-z+y)/2;if (2*a!=x-z+y||a<=0) continue;
ll b=(x+z-y)/2;if (2*b!=x+z-y||b<=0) continue;
ll c=(-x+z+y)/2;if (2*c!=-x+z+y||c<=0) continue;
if (a==b&&b==c) rez++; else
if (a!=b&&a!=c&&b!=c) rez+=6; else rez+=3;
//cout<<a<<" "<<b<<" "<<c<<endl;
//if (a1-(int)a1==0&&b1-(int)b1==0&&c1-(int)c1==0) rez++;
}
}
cout<<rez<<endl;
return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define sz(a) (int)a.size()
#define de(x) cout << #x << " = " << x << endl
#define dd(x) cout << #x << " = " << x << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef double db;

ll n;

int main() {
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	cin >> n;
	ll ans = 0;
	if(n % 3 == 0) {
		n /= 3;
		vector<ll> v;
		for(int i = 1; 1ll * i * i <= n; ++i) if(n % i == 0) {
			v.pb(i);
			if(n / i != i) v.pb(n / i);
		}
		sort(all(v));
		rep(i, 0, sz(v)) {
			if(v[i] * v[i] * v[i] > n) break;
			rep(j, i, sz(v)) {
				if(v[i] * v[j] * v[j] > n) break;
				if(n % (v[i] * v[j])) continue;
				ll k = n / v[i] / v[j];
				if(k < v[j]) continue;
				ll a = v[i] + v[j] - k, b = v[i] + k - v[j], c = v[j] + k - v[i];
				if(a > 0 && a % 2 == 0 && b > 0 && b % 2 == 0 && c > 0 && c % 2 == 0) {
					if(a != b && a != c && b != c) ans += 6;
					else if(a == b && b == c) ans++;
					else ans += 3;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

#include"iostream"
#include"cstdio"
#include"cmath"
using namespace std;
__int64 n;
__int64 fac[1000000], cnt;

int main()
{
    __int64 ans, i, j, t, a, b, c;
    while(~scanf("%I64d",&n))
    {
        ans=0;
        if(n%3==0)
        {
            n/=3, cnt=0;
            for(i=1; i*i<=n; i++) if(n%i==0) fac[cnt++]=i;
            for(i=0; i<cnt; i++)
            {
                a=fac[i], t=n/fac[i];
                for(j=0; j<cnt && fac[j]*fac[j]<=t ; j++)
                {
                    if(t%fac[j]) continue;
                    b=fac[j], c=t/fac[j];
                    if(a+b>c && b+c>a && a+c>b && (!((a+b+c)&1))) ans+=(b*b==t ? 1 : 2);
                }
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <stdio.h>

#define MAXPRIME 10000000L

using namespace std;

uint64_t mysqrt(uint64_t k) {
   uint64_t lo = 1;
   uint64_t hi = k;

   while (lo <= hi) {
      uint64_t mid = lo + (hi - lo)/2;
      if (mid * mid > k)
         hi = mid - 1;
      else if (mid * mid < k)
         lo = mid + 1;
      else
         return mid;
   }
   return hi;
}

int main() {
   uint64_t n;
   cin >> n;

   if (n % 3 != 0) {
      printf("0\n");
      return 0;
   }

   n = n/3;

   uint64_t soln = 0;
   for (uint64_t x=2; x*x*x <= n; x++) {
      if (n % x != 0) continue;
      uint64_t nx = n / x;

      uint64_t sqnx = mysqrt(nx);

      for (uint64_t y=sqnx; y >= x; y--) {
         if (nx % y != 0) continue;
         uint64_t z = nx / y;
         uint64_t s2 = x + y + z;

         if (s2 <= 2*z) break;
         if (s2 % 2 == 0) {
            if (x == y && y == z)
               soln++;
            else if (x == y || y == z || x == z)
               soln += 3;
            else
               soln += 6;
         }
      }
   }

   cout << soln << "\n";
}

#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:128000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const long double PI = 3.14159265358979323846;
const long double gammama = 0.57721566490153286060;
const long double eps = 1e-5;
const int INF = 1000 * 1000 * 10 + 10;
const int N = 1000 * 10000 + 10;

int main() {
	//ios_base::sync_with_stdio(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n;
	cin >> n;
	if (n % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}
	n /= 3;
	ll up = sqrt((double)n) + 30;
	vector<ll> d;
	for (ll i = 1; i < up; ++i) {
		if (n % i == 0)
			d.push_back(i);
	}
	//cout << d.size() << endl;
	ll res = 0;
	for (int i = 0; i < d.size(); ++i) {
		for (int j = 0; j < i; ++j) {
			ll d1 = d[i];
			ll d2 = d[j];
			ll d3 = n / d1 / d2;
			if (d1 * d2 * d3 == n) {
				if ((d3 < d2) && (d2 + d3 > d1) && ((d1 + d2 + d3) % 2 == 0))
					res += 6;
			}
		}
		ll d1 = d[i];
		ll d2 = d[i];
		ll d3 = n / d1 / d2;
		if ((d1 * d2 * d3 == n) && ((d1 + d2 + d3) % 2 == 0)) {
			if (d3 == d1)
				++res;
			else
				if (d3 < d1)
					res += 3;
				else
					if (d1 + d2 > d3)
						res += 3;
		}
	}
	cout << res << endl;

	return 0;
}

#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <ctime>
#include <iomanip>
#include <vector>
#include <set>
#include <stack>
#include <math.h>
#include <queue>
#include <stdlib.h>
#define F first
#define S second
#define ll long long

using namespace std;
ll n,x,y,z,ans,a1,a2,a3,r1,r2;
set <ll> a;
set <ll>::const_iterator i,j;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    if (n%3!=0) cout << "0"; else
    {
        n/=3;
        for (ll i=1;i*i<=n;i++)
            if (n%i==0) {
            a.insert(i);
            }
        for ( i=a.begin();i!=a.end();i++)
        {
            r1=n/(*i);
            for (set <ll>::const_iterator j=i;j!=a.end();j++)
                if (r1%(*j)==0)
            {
                r2=r1/(*j);
                if (r2>=*j)
                if (a.find(r2)!=a.end())
                    {
                        x=*i;
                        y=*j;
                        z=r2;
                        if (x+y>z && x+z>y && y+z>x && (x+y-z)%2==0 && (x+z-y)%2==0 && (y+z-x)%2==0){
                            a1=(x+y-z)/2; a2=(x+z-y)/2; a3=(y+z-x)/2;
                            if (a1==a2 && a2==a3)
                            ans++; else
                            if (a3==a1 || a3==a2 || a1==a2)
                            ans+=3; else
                            ans+=6;
                        }
                    }
            }
        }
        cout << ans;
    }
}

#include <cstdio>
#include <algorithm>
#include <vector>
#include <list>

using namespace std;

long long fast_pow(long long a, long long b) {
  if (b == 0) {
    return 1;
  } else {
    long long ans = fast_pow(a, b/2);
    if (b%2 == 0) {
      return ans*ans;
    } else {
      return ans*ans * a;
    }
  }
}

long long isqrt(long long num) {
  long long ans = sqrt(1.0*num);
  while(ans*ans < num) ++ans;
  while(ans*ans > num) --ans;
  return ans;
}

int main(){
  long long n;
  scanf("%lld", &n);
  if (n%3 != 0) {
    puts("0");
  } else {
    long long count = 0;
    long long n3 = n/3;
    vector<long long> bpcs;
    bpcs.reserve(50000);
    for (long long bpc = 2; bpc*bpc*bpc <= n3; ++bpc) {
      if ((4*n3) % bpc == 0) {
	bpcs.push_back(bpc);
      }
    }
    for (long long c = 1; 8*c*c*c <= n3; ++c) {
      auto p_bpc = lower_bound(bpcs.begin(), bpcs.end(), c*2);
      for(; p_bpc != bpcs.end(); ++p_bpc) {
	long long bpc = *p_bpc;
	long long b = bpc - c;
	if (2*b*bpc*bpc > n3) {
	  break;
	}
	long long bpc2 = bpc*bpc;
	long long bpc4 = bpc2*bpc2;
	long long delt = bpc4 - 4*bpc2*b*c + 4*bpc*n3;

	long long sdelt = isqrt(delt);

	long long up = sdelt - bpc2;
	if (sdelt * sdelt != delt || up <= 0 || up % (2*bpc) != 0) {
	  continue;
	}
	long long a = up / (2*bpc);
	if (a >= b) {
	  if (a == b && b == c) {
	    count += 1;
	  } else if (a == b || b == c) {
	    count += 3;
	  } else {
	    count += 6;
	  }
	}
      }
    }
    printf("%lld\n", count);
  }
  return 0;
}

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>
#include<complex>
using namespace std;

#define pb push_back
#define mp make_pair
#define x first
#define y second
#define SZ(x) (int(x.size()))
typedef long long LL;

int pn;
LL pri[10000000];
LL cnt[10000000];

typedef set< pair<pair<LL, LL>, LL>  > spLLL;
set< pair<pair<LL, LL>, LL>  > tree;

LL total = 0;

vector<LL> divis;

int main()
{
  long long n;
  while(cin >> n){
    tree.clear();
    if(n%3LL!=0){

    }else{
      n/=3LL;
      divis.clear();
      for(LL i=1;i*i<=n;i++){
        if(n%i==0)divis.pb(i);
      }
      for(LL i=0;divis[i]*divis[i]*divis[i]<=n && i<SZ(divis);i++){
          for(LL j=i;divis[i]*divis[j]*divis[j]<=n && j<SZ(divis);j++){
            if(n%(divis[j]*divis[i])==0){
              LL k1 = divis[i], k2 = divis[j], k3 = n/(divis[i]*divis[j]);
              if((k1+k2+k3)%2==0){
                LL tl = (k1+k2+k3)/2;
                if(k1>=tl || k2>=tl || k3>=tl)continue;
                LL nu[3];
                nu[0] = tl - k1; nu[1] = tl - k2; nu[2] = tl - k3;
                if(nu[1]<=nu[0] && nu[1]<=nu[2])swap(nu[0], nu[1]);
                if(nu[2]<=nu[0] && nu[2]<=nu[1])swap(nu[0], nu[2]);
                if(nu[2]<nu[1]) swap(nu[1],nu[2]);
                tree.insert(mp(mp(nu[0],nu[1]),nu[2]));
              }
            }
          }
      }
    }
    total = 0;
    for(spLLL::iterator itr = tree.begin();itr!=tree.end();++itr){
      LL a = itr->x.x;
      LL b = itr->x.y;
      LL c = itr->y;
      //cout << a << " " << b << " " << c << endl;
      if(a==b && b==c) total++;
      if(a!=b && b==c) total+=3;
      if(a==b && b!=c) total+=3;
      if(a!=b && b!=c) total+=6;

    }
    cout << total << endl;
  }
  return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
#define N 1001000
LL l[N],tot,n,ans;

int main()
{
	cin>>n;
	if (n%3) return cout<<0,0;
	n/=3;
	for (LL i=2;i*i<=n;i++)
		if (n%i==0)
			l[tot++]=i;
	for (int i=0;i<tot;i++)
		for (int j=tot-1;j>=0;j--)
			{
				LL a=l[i], b=l[j], c=n/l[i]/l[j];
				if ((a+b+c)&1||a*b*c!=n||b>c) continue;
				if (a>b||a+b<=c||b+c<=a) break;
				if (a==b&&a==c) ans++;
				else if (a==b||a==c||b==c) ans+=3;
				else ans+=6;
			}
	cout<<ans<<endl;
	return 0;
}

#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <fstream>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define F first
#define S second
#define PB push_back
#define PF push front
#define MP make_pair
#define REP(x, n) for(int x=0; x<(n); ++x)
#define FOR(x, b, e) for(int x=b; x<=(e); ++x)
#define FORD(x, b, e) for(int x=b; x>=(e); --x)
#define VAR(v,n) __typeof(n) v=(n)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define MOD(x, n) ((x)%(n)+(n))%(n)
#define SZ(x) (int((x).size()))
#define ALL(x) ((x).begin()),((x).end())
#define SORT(v) sort((v).begin(),(v).end())
#define REV(v) reverse((v).begin(),(v).end())
#define UNIQUE(v) SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
LL GCD( LL a , LL b ) { while( b ) b ^= a ^= b ^= a %= b ; return a ; }
LL LCM( LL a , LL b ) { return a * ( b / GCD( a , b ) ) ; }

typedef vector<int>    VI;
typedef vector<string> VS;
typedef vector<VI>     VVI;
typedef vector<LL>     VLL;
typedef vector<bool>   VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII>    VPII;
typedef pair<LL, LL>   PLL;
typedef vector<PLL>    VPLL;

const double EPS = 10e-9;
const LL INF = (1LL << 30);

using namespace std;

template<typename T>
string toString(T t) {
    stringstream ss;
    ss << t;
    return ss.str();
}

LL isSquare(LL N) {
    LL lo = 1, hi = 2*sqrt(N);
    while(hi - lo > 1) {
        LL mid = (hi+lo) >> 1;

        LL res = mid*mid;
        if(res < N) {
            lo = mid;
        } else if(res > N) {
            hi = mid;
        } else {
            return mid;
        }
    }

    return lo;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    LL N;
    cin >> N;

    if(N % 3 != 0) {
        cout << 0 << endl;
    } else {
        N /= 3;
        int options = 0;
        for(LL i = 1; i*i*i <= N; i++) {
            if(N % i == 0) {
                LL left = N/i, to = i/2;
                for(LL a = 1; a <= to; a++) {
                    LL c = i-a;
                    LL d = (a-c)*(a-c);
                    LL sqr = isSquare(d+4*left);
                    if(sqr*sqr == d+4*left) {
                        LL b = (-(a+c)+sqr) >> 1;
                        if(c <= b) {
                            if(a == c) {
                                if(b == c) {
                                    options += 1;
                                } else {
                                    options += 3;
                                }
                            } else {
                                if(b == c) {
                                    options += 3;
                                } else {
                                    options += 6;
                                }
                            }
                        }
                    }
                }
            }
        }
        cout << options << endl;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define MAX 1000005
#define pb push_back
#define MOD 1000000007
typedef long long ll;

vector < ll > fac;

void get_fact(ll x){
    for(ll i=1; i*i<=x; i++){
        if(x%i == 0){
            fac.pb(i);
        }
    }
}

int  main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif // !ONLINE_JUDGE

    ll n; scanf("%I64d",&n);

    if(n%3){
        cout << 0;
        return 0;
    }

    ll r = n /3;

    get_fact(r);

    ll res = 0;

//    for(auto x:fac)
//        cout << x << " ";
//    cout << endl;

    for (int i=0; i<fac.size(); i++)
        for (int j=0; j<fac.size(); j++){
            ll a=fac[i] , b=fac[j] , c=(r/a)/b;
            if (!(r % (a * b)) && !((a + b + c) % 2)){
                if(a+b > c && a+c > b && b+c > a){
                    res++;
                }
            }
        }
    printf("%I64d\n",res);
}

#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#define int64 long long
#define For(i,x,y) for (i=x;i<=y;i++)
using namespace std;
int64 i,j,k,n,m,an;
inline int work(int a,int b,int c) {
	return a==b&&b==c?1:a==b||b==c?3:6;
}
int main() {
	scanf("%I64d",&n);
	if (n%3) {
		printf("0\n"); return 0;
	}
	n/=3;
	int A=(int)(pow(n,1./3)+1e-9);
	For(i,2,A) if (n%i==0) {
		int B=int(sqrt(n/i)+1e-9);
		for(j=B;j>=i;j--) if (n/i%j==0) {
			int C=n/i/j;
			if (i+j<=C) break;
			if (j<=C&&(i+j+C)%2==0) {
				int D=(i+j+C)/2;
				an+=work(D-C,D-j,D-i);
			}
		}
	}
	printf("%I64d\n",an);
	//for(;;);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ullong;

ullong my_sqrt(ullong k) {
    ullong low = 1, high = k;
    while (low <= high) {
        ullong mid = low + ((high - low) >> 1);
        if (mid * mid > k)
            high = mid - 1;
        else if (mid * mid < k)
            low = mid + 1;
        else
            return mid;
    }
    return high;
}

int main() {
    ullong n;
    scanf("%llu", &n);
    if (n % 3) {
        puts("0");
        return 0;
    }
    n /= 3;
    ullong res = 0;
    for (ullong x = 2; x * x * x <= n; ++x) {
        if (n % x)
            continue;
        ullong nx = n / x;
        ullong sqrt_nx = my_sqrt(nx);
        for (ullong y = sqrt_nx; y >= x; --y) {
            if (nx % y)
                continue;
            ullong z = nx / y;
            ullong sum = x + y + z;
            if (sum <= z << 1)
                break;
            if (sum & 1)
                continue;
            if (x == y && y == z)
                ++res;
            else if (x == y || y == z || z == x)
                res += 3;
            else
                res += 6;
        }
    }
    printf("%llu", res);
}

#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <map>
using namespace std;

long long n,i,answer,m,apb,apc,bpc,same;
vector <long long> v;
int k,j;

main()
{
 cin>>n;

 if ( n%3LL )
  {
   cout<<0<<endl;
   return 0;
  }

 // n=3(a+b)(b+c)(a+c)

 n/=3LL;

 for ( i=2LL;i*i<=n;i+=1LL )
  if ( n%i==0LL )
   {
    v.push_back(i);
    if ( (i*i)!=n )
     v.push_back(n/i);
   }
 sort(v.begin(),v.end());

 for ( j=0;j<v.size() && v[j]*v[j]*v[j] <= n;j++ )
  {
   apb=v[j];
   m=n/apb;
   for ( k=0;k<v.size() && v[k]*v[k]<=m; k++ )
    if ( m%v[k]==0LL )
     if ( (m/v[k])>1LL )
     {
      apc=v[k];
      bpc=m/v[k];
      if ( apb<=apc && apc<=bpc )
       if ( (apb+apc)>bpc )
       if ( (apb+apc+bpc)%2LL==0LL )
       {
        if ( apb==apc && apc==bpc ) answer+=1LL;
        else if ( apb==apc ) answer+=3LL;
        else if ( apc==bpc ) answer+=3LL;
        else answer+=6LL;
       }
     }
  }

 cout<<answer<<endl;
 //system("pause");

 return 0;
}

#include <iostream>
#include <vector>

using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); i++)

typedef long long ll;

vector<ll> d;

int main () {
	ll n;
	cin >> n;
	if (n % 3) {
		cout << 0 << endl;
		return 0;
	}
	n /= 3;
	for (ll q = 1; q * q <= n; ++q) {
		if (n % q == 0) {
			d.push_back(q);
		}
	}
	ll ans = 0;
	forn (i, d.size()) {
		ll a = d[i];
		ll p = n / a;
		for (int i = 0; i < d.size() && d[i] * d[i] <= p; ++i) {
			if (p % d[i]) {
				continue;
			}
			ll b = d[i];
			ll c = p / d[i];
			if ((a + b + c) % 2) {
				continue;
			}
			if (a + b <= c || a + c <= b || b + c <= a) {
				continue;
			}

			ans++;
			if (d[i] * d[i] < p) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

#include<cstdlib>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<list>
#include<queue>
#include<vector>
#define ULL unsigned long long
#define LL long long
#define UI unsigned int
#define inf 0x7fffffff
#define eps 1e-8
#define N 10000009
#define M 60009
using namespace std;
LL T,n,m,k,t;
LL s[N];
int main()
{
#ifndef ONLINE_JUDGE
    freopen("ex.in","r",stdin);
#endif
    int ncase=0;
    while (scanf("%I64d",&n)==1)
    {
        if(n%3)
        {
            printf("0\n");continue;
        }
        n/=3;
        int cnt=0;
        for(LL i=2;i*i<=n;i++)
        if(n%i==0)
        {
            s[cnt++]=i;
//            cout<<i<<" ";
        }
//        cout<<endl;
        LL ans=0;
        for (int i=0;i<cnt;++i )
        for(int j=i;j<cnt;j++)
        {
            LL a=s[i],b=s[j];
            LL c=n/(a*b);
            if(a*b*c!=n)continue;
            if(a+b<c+2)continue;//
            if((a+b-c)%2)continue;
//            if((a+c-b)%2)continue;
//            if((c+b-a)%2)continue;
//            if((a+b+c)%2)continue;
            if(c<b)break;
            if(a==b&&a==c)ans++;
            else if(a==b||b==c)ans+=3;
            else ans+=6;
        }
        cout<<ans<<endl;
    }
    return 0;
}

#include<algorithm>
#include<cassert>
#include<complex>
#include<map>
#include<iomanip>
#include<sstream>
#include<queue>
#include<set>
#include<string>
#include<vector>
#include<iostream>
#include<cstring>
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define fup FOR
#define fdo FORD
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define siz SZ
#define CLR(x) memset((x), 0, sizeof(x))
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define FI X
#define SE Y
#define SQR(a) ((a)*(a))
#define DEBUG 1
#define debug(x) {if (DEBUG)cerr <<#x <<" = " <<x <<endl; }
#define debugv(x) {if (DEBUG) {cerr <<#x <<" = "; FORE(it, (x)) cerr <<*it <<", "; cout <<endl; }}
using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int>P;
typedef vector<int>VI;
const int INF=1E9+7;
template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<typename T1, typename T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { out << "(" << pair.FI << ", " << pair.SE << ")"; return out; }

int ile(LL a, LL b, LL c) {
    assert(a <= b && b <= c);
    if (a == b && b == c) return 1;
    if (a < b && b < c) return 6;
    return 3;
}

int main(){
	ios_base::sync_with_stdio(false);
    LL n;
    cin >> n;
    if (n % 3) { cout << 0 << endl; return 0; }
    n /= 3;
    LL s = 0;
    vector<LL> d;
    LL u = 1;
    while (u * u <= n) {
        if (n % u == 0) d.PB(u);
        ++u;
    }

    fup(ix, 0, siz(d) - 1) fup(iy, ix, siz(d) - 1) {
        LL x, y, z;
        x = d[ix];
        y = d[iy];
        z = n / x / y;
        if (x * y * z != n) continue;
        LL a, b, c;
        if ((x + y - z) % 2) continue;
        if ((x - y + z) % 2) continue;
        if ((-x + y + z) % 2) continue;
        a = (x + y - z) / 2;
        b = (x - y + z) / 2;
        c = (-x + y + z) / 2;
        if (a < 1 || b < 1 || c < 1) continue;
        //cout << "TAK " << a << " " << b << " " << c << endl;
        if (a <= b && b <= c) s += ile(a, b, c);
    }

    cout << s << endl;

	return 0;
}

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstdio>
#include<string.h>
#include<set>
#include<map>
using namespace std;

typedef long long Int;
#define FOR(i,a,b)  for(int i=(a);i<=(b);++i)
#define sz(s) (int)(s).size()
#define mp make_pair
#define pb push_back
void assert(bool x){if(!x)throw -1;}
const int inf = 1000000000;
const int MOD = 1000000007;
#define sqr(x) (x)*(x)
const double PI = acos(-1.0);

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	Int n;cin>>n;
	if(n%3>0){
		puts("0");
		return 0;
	}

	vector<Int>d;
	n/=3;
	for(Int i=1;i*i<=n;++i)if(n%i==0){
		d.pb(i);
		if(i*i!=n)d.pb(n/i);
	}
	sort(d.begin(),d.end());

	Int total = 0;
	for(int i=0;n/d[i]/d[i]/d[i]>=1;++i){
		Int m = n/d[i];
		for(int j=i;m/d[j]/d[j]>=1;++j)if(m%d[j]==0){
			Int k = m/d[j];
			if(k<d[j])continue;

			Int s = (k+d[i]+d[j]);
			if(s&1)continue;
			s>>=1;

			Int a = s-k,b=s-d[i],c=s-d[j];
			if(a<=0 || b<=0 || c<=0)continue;

			if(a!=b && a!=c && b!=c)total+=6;else
				if(a==b && b==c)total+=1;else
					total+=3;
		}
	}

	cout<<total<<endl;
}

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ullong;

ullong my_sqrt(ullong k) {
    ullong low = 1, high = k;
    while (low <= high) {
        ullong mid = low + ((high - low) >> 1);
        if (mid * mid > k)
            high = mid - 1;
        else if (mid * mid < k)
            low = mid + 1;
        else
            return mid;
    }
    return high;
}

int main() {
    ullong n;
    scanf("%llu", &n);
    if (n % 3) {
        puts("0");
        return 0;
    }
    n /= 3;
    ullong res = 0;
    for (ullong x = 2; x * x * x <= n; ++x) {
        if (n % x)
            continue;
        ullong nx = n / x;
        ullong sqrt_nx = my_sqrt(nx);
        for (ullong y = sqrt_nx; y >= x; --y) {
            if (nx % y)
                continue;
            ullong z = nx / y;
            ullong sum = x + y + z;
            if (sum <= z << 1)
                break;
            if (sum & 1)
                continue;
            if (x == y && y == z)
                ++res;
            else if (x == y || y == z || z == x)
                res += 3;
            else
                res += 6;
        }
    }
    printf("%llu", res);
}

#include <cstdio>
#include <iostream>
#include <algorithm>

const int MAXN = 1e7+10;

using namespace std;

long long N;
long long factor[MAXN];
int si;

int main()
{
	cin >> N;
	long long A = N/3;
	if(A*3 != N)
	{
		printf("0\n");
		return 0;
	}
	for(long long c = 2 ; c*c <= A ; c++)
	{
		long long a = A/c;
		if(a*c == A)
			factor[si++] = c;
	}
	// printf("%d\n", si);
	long long sol = 0;
	for(int c = 0 ; c < si ; c++)
	{
		long long a = factor[c];
		long long b = A/a;
		for(int d = c ; d < si ; d++)
		{
			long long x = b/factor[d];
			if(a <= factor[d] and factor[d] <= x and x*factor[d] == b and ((a+factor[d]+x)&1) == 0)
			{
				// a,factor[d],x
				if(a+factor[d] > x)
				{
					if(a == factor[d] and factor[d] == x)
						sol++;
					else if(a == factor[d] or factor[d] == x or a == x)
						sol += 3;
					else
						sol += 6;
				}
			}
		}
	}
	cout << sol << endl;
}

#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int res = 0;

void add(int a, int b, int c) {
   // a <= b <= c;
   if (a < b && b < c) {
       res += 6;
       return;
   }
   if (a == b && b == c) {
       res += 1;
       return;
   }
   res += 3;
}

long long n;
vector<int> divi;

int main() {
	cin >> n;
	if (n % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}
	int a_max = pow(n / 24., 1/3.);
	long long m = n / 3;
	int b_max = pow(n / 6., 1/3.);
	for (int i = 2; i <= b_max + a_max; i++)
		if (m % i == 0)
			divi.push_back(i);
	for (int a = 1; a <= a_max; a++)
		for (int bi = 0; bi < divi.size(); bi++) {
			int sum = divi[bi];
			int b = sum - a;
			if (b < a || b > b_max)
				continue;
			long long K = m / sum;
			long long B = sum * 1L * sum;

			long long di = B - 4 * (a * 1L * b - K);

			double desc = sqrt(di+0.);
			int desc2 = (int) (desc + 0.5);
			if (abs(desc - desc2) > 0.000001)
				continue;
			int c = (-sum + desc2) / 2;
			if (c < b)
				continue;
			add(a, b, c);
		}
	cout << res << endl;
}

#include <bits/stdc++.h>
using namespace std;

long long ans = 0;

void solve(long long i, long long j, long long k) {
	long long ji = j - i; // c - b
	if ((k + ji) % 2) return;
	long long c = (k + ji) / 2;
	long long b = k - c;
	long long a = i - b;
	if (1 <= a && a <= b && b <= c) {
		if (a == b && b == c) ans++;
		else if (a == b || b == c) ans += 3;
		else ans += 6;
	}
}

vector<long long> fac;

int main()
{
	long long n;
	cin >> n;
	if (n % 3) {
		cout << 0 << endl;
		return 0;
	}

	n /= 3;

	for (long long i = 1; i * i <= n; i++)
		if (n % i == 0) {
			fac.push_back(i);
			if (i * i != n) fac.push_back(n / i);
		}
	/*
	 * i = a + b
	 * j = a + c
	 * k = b + c
	 */
	sort(fac.begin(), fac.end());
	for (long long i = 0; i < fac.size(); i++) {
		long long m = n / fac[i];
		for (long long j = i; fac[j] * fac[j] <= m && j < fac.size(); j++) {
			if (m % fac[j]) continue;
			else {
				long long k = m / fac[j];
				if (fac[i] <= fac[j] && fac[j] <= k) solve(fac[i], fac[j], k);
			}
		}
	}

	cout << ans << endl;
	return 0;
}

#include<stdio.h>
#include<vector>
#include<iostream>
using namespace std;

int main()
{
	vector<long long> v;
	long long n,x,y,z,N,ans=0;
	cin >> n;
	if( n%3 == 0 ){
		n /= 3;
		for( long long i = 1; i*i <= n; i++ )
			if( n%i == 0 )	v.push_back(i);
		for( int i = 0; i < v.size(); i++ ){
			x = v[i];
			if( x*x*x > n )	break;
			N = n/x;
			for( int j = i; j < v.size(); j++ ){
				y = v[j];
				if( y*y > N )break;
				if( N%y == 0 ){
					z = N/y;
					if( (x+y+z)%2 == 0 && x+y>z ){
						if( x == y && y == z )ans+=1;
						else if( x != y && y != z )ans+=6;
						else	ans+=3;
					}
				}
			}
		}
		cout << ans << endl;
	}else{
		cout << "0\n";
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;
typedef unsigned long long ull;

#define F first
#define S second
#define en end()
#define bg begin()
#define rev reverse
#define mp make_pair
#define pb push_back
#define y1 y1234567890
#define um unordered_map
#define all(x) x.bg, x.en
#define sqr(x) ((x) * (x))
#define sz(x) (int)x.size()

const ll inf = (ll)9e18;
const ll mod = (ll)1e9 + 7;
const double pi = acos(-1.0);
const double eps = (double)1e-9;

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const int N = 100500;

ll n, pr[N];
int sz, ans, pw1[N], pw2[N];

inline bool check(ll x, ll y, ll z) {
	if ((x + y - z) & 1)
		return 0;
	if ((x + z - y) & 1)
		return 0;
	if ((y + z - x) & 1)
		return 0;
	ll a = ((x + y - z) >> 1);
	ll b = ((x + z - y) >> 1);
	ll c = ((y + z - x) >> 1);
	if (a < 1 || b < 1 || c < 1)
		return 0;
	if ((a + b) * (b + c) * (a + c) == n)
		return 1;
	return 0;
}

void rec2(int pos, ll y, ll x) {
	if (pos == sz + 1) {
		if (check(x, y, n / x / y))
			ans++;
		return;
	}
	for (int i = 0; i <= pw2[pos]; i++) {
		rec2(pos + 1, y, x);
		y *= pr[pos];
	}
}

void rec1(int pos, ll x) {
	if (pos == sz + 1) {
		if (x > 1)
			rec2(1, 1, x);
		return;
	}
	for (int i = 0; i <= pw1[pos]; i++) {
		pw2[pos] = pw1[pos] - i;
		rec1(pos + 1, x);
		x *= pr[pos];
	}
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	//cin.tie(NULL);
	//cout.tie(NULL);
	//ios_base::sync_with_stdio(false);

	cin >> n;

	if (n % 3 != 0) {
		cout << 0;
		return 0;
	}

	n /= 3;

	ll m = n;

	for (int i = 2; i * 1ll * i <= m; i++) {
		if (n % i == 0) {
			sz++;
			pr[sz] = i;
			while (m % i == 0) {
				pw1[sz]++;
				m /= i;
			}
		}
	}

	if (m != 1) {
		sz++;
		pr[sz] = m;
		pw1[sz] = 1;
	}

	rec1(1, 1);

	cout << ans;

	return 0;
}

#include <iostream>
#include <cmath>

#pragma comment(linker, "/STACK:167772160")

using namespace std;

bool sqr(long long x){
        long double y=sqrt((long double)x);
        return abs(ceil(y)-y)<1e-18;
    }

int main()
{
    long long n;
    cin>>n;
    long long div[10000000];
    int k=0;
    if(n%3!=0){
            cout<<0;
            return 0;
        }
        n/=3;
        for(long long i=2;i*i<=n;i++){
            if(n%i==0){
                div[k++]=i;
                if(n/i!=i)
                    div[k++]=n/i;
            }
        }
        long long ans=0;
        for(int i=0;i<k;i++){
            long long x=div[i];
            long long m=n/x;
            for(long long b=1;b<x;b++){
                long long c=x-b;
                long long y=b*c-m;
                if(y>=0||b>c)break;
                long long d=x*x-4*y;
                if(d<0)break;
                if(!sqr(d))continue;
                long long a=(-x+(long long )sqrt((long double)d))/2;
                if(a>b||a<=0)continue;
                if(a==b&&b==c){
                    ans++;
                }
                else
                    if(a==b||a==c||b==c){
                        ans+=3;
                    }
                else
                        ans+=6;
            }
        }
        cout<<ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long n,ans=0;
int main()
{
	cin>>n;
	if(n%3)
	{
		puts("0");
		return 0;
	}
	n/=3;
	for(long long i=1;i*i*i<=n;++i)
		if(n%i==0)
			for(long long n1=n/i,j=sqrt(n1);j>=i;--j)
				if(n1%j==0)
				{
					long long n2=n1/j;
					if(i+j<=n2)
						break;
					if((i+j+n2)%2==0)
					{
						if(i==j && j==n2) ans+=1;
						else if(i==j || j==n2 || n2==i) ans+=3;
						else ans+=6;
					}
				}
	cout<<ans<<endl;
	return 0;
}

#include <cstdio>
#include <algorithm>
#include <vector>
#include <list>

using namespace std;

long long fast_pow(long long a, long long b) {
  if (b == 0) {
    return 1;
  } else {
    long long ans = fast_pow(a, b/2);
    if (b%2 == 0) {
      return ans*ans;
    } else {
      return ans*ans * a;
    }
  }
}

long long isqrt(long long num) {
  long long ans = sqrt(1.0*num);
  while(ans*ans < num) ++ans;
  while(ans*ans > num) --ans;
  return ans;
}

int main(){
  long long n;
  scanf("%lld", &n);
  if (n%3 != 0) {
    puts("0");
  } else {
    long long count = 0;
    long long n3 = n/3;
    vector<long long> bpcs;
    bpcs.reserve(50000);
    for (long long bpc = 2; bpc*bpc*bpc <= n3; ++bpc) {
      if ((4*n3) % bpc == 0) {
	bpcs.push_back(bpc);
      }
    }
    for (long long c = 1; 8*c*c*c <= n3; ++c) {
      auto p_bpc = lower_bound(bpcs.begin(), bpcs.end(), c*2);
      for(; p_bpc != bpcs.end(); ++p_bpc) {
	long long bpc = *p_bpc;
	long long b = bpc - c;
	if (2*b*bpc*bpc > n3) {
	  break;
	}
	long long bpc2 = bpc*bpc;
	long long bpc4 = bpc2*bpc2;
	long long delt = bpc4 - 4*bpc2*b*c + 4*bpc*n3;

	long long sdelt = isqrt(delt);

	long long up = sdelt - bpc2;
	if (sdelt * sdelt != delt || up <= 0 || up % (2*bpc) != 0) {
	  continue;
	}
	long long a = up / (2*bpc);
	if (a >= b) {
	  if (a == b && b == c) {
	    count += 1;
	  } else if (a == b || b == c) {
	    count += 3;
	  } else {
	    count += 6;
	  }
	}
      }
    }
    printf("%lld\n", count);
  }
  return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#include <iostream>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
typedef tuple<int, int, int> tp;

lint n;
vector<lint> v;
set<tp> ret;

void submit(int a, int b, int s){
	if(1ll * (a + b) * (b + s) * (a + s) == n){
		ret.insert(make_tuple(a, b, s));
		ret.insert(make_tuple(a, s, b));
		ret.insert(make_tuple(b, a, s));
		ret.insert(make_tuple(b, s, a));
		ret.insert(make_tuple(s, a, b));
		ret.insert(make_tuple(s, b, a));
	}
}

int intsqrt(lint x){
	if(x < 0) return -1;
	int b = sqrt(x);
	if(1ll * b * b == x) return b;
	return -1;
}

int main(){
	cin >> n;
	if(n%3 != 0){
		puts("0");
		return 0;
	}
	n /= 3;
	for(int i=2; i<=44444; i++){
		if(n%i == 0){
			v.push_back(i);
		}
	}
	for(int a=1; a<=22222; a++){
		for(auto &j : v){ // a + b
			int b = j - a;
			if(b >= a){
				if(j * (a + b) * (b + b) > n) break;
				lint t = n / j;
				lint det = j * j - 4ll * (1ll * a * b - t);
				int u = intsqrt(det);
				if(u < 0) continue;
				int geun1 = (u - j), geun2 = (-u - j);
				if(geun1 % 2 == 0 && geun1/2 >= b) submit(a, b, geun1/2);
				if(geun2 % 2 == 0 && geun2/2 >= b) submit(a, b, geun2/2);
			}
		}
	}
	cout << ret.size();
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <ctime>

using namespace std;

#define INF 1e+9
#define mp make_pair
#define pb push_back
#define fi first
#define fs first
#define se second
#define i64 long long
#define li long long
#define lint long long
#define pii pair<int, int>
#define vi vector<int>

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    //freopen("outp", "w", stdout);
#else
    // freopen(TASKNAME ".in", "r", stdin);
    // freopen(TASKNAME ".out", "w", stdout);
#endif
    int start_time = clock();
    i64 n;
    cin >> n;
    if (n % 3 != 0)
    {
        cout << 0;
        exit(0);
    }
    n /= 3;
    int ans = 0;
    for (int x1 = 2; (i64)x1 * x1 * x1 <= n; x1++) if (n % x1 == 0)
    {
        i64 m = n / x1;
        int bound = sqrt(m);
        int start = x1;
        int finish = bound;
        while(start < finish)
        {
            int middle = (start + finish) / 2;
            i64 x3 = m / middle;
            i64 a = (x1 - middle + x3) / 2;
            i64 b = x1 - a;
            if (b >= 1)
                finish = middle;
            else start = middle + 1;
        }
        for (int x2 = start; x2 <= bound; x2++) if (m % x2 == 0)
        {
            i64 x3 = m / x2;
            if (x1 - x2 + x3 <= 0)
                break;
            if ((x1 - x2 + x3) % 2 != 0)
                continue;
            int a = (x1 - x2 + x3) / 2;
            int b = x1 - a;
            int c = x3 - a;
            if (a < 1)
                break;
            if (b >= 1)
            {
                //cout << "found " << x1 << " " << x2 << " " << x3 << " " << a << " "  << b << " " << c << endl;
                //ans++;
                if (b == a)
                {
                    ans += (a == c ? 1 : 3);
                }
                else ans += (a == c ? 3 : 6);
            }
        }
    }
    printf("%d\n", ans);
#ifdef LOCAL
    printf("time = %d\n", (int)clock() - start_time);
#endif
}

#include<algorithm>
#include <iostream>
#include <vector>

using namespace std;
struct triplet{
    long long x, y, z;
    triplet(){};
    triplet ( long long x, long long y, long long z ){
        this->x = x;
        this->y = y;
        this->z = z;
    }

    bool operator<( triplet t1 )const{
        if ( t1.x == x )
            if ( t1.y == y )
                return z < t1.z;
            else
                return y < t1.y;
        else
            return x < t1.x;
    }
};
long long N;
vector <triplet> v;
vector < long long > dv;

void scan(){
    cin >> N;
}

void generate ( long long i, long long p ){

}
void generateTriplets ( long long p ){
    for ( long long i = 1; i * i <= p; ++i )
        if ( p % i == 0 ){
            dv.push_back ( i );
        }
    sort ( dv.begin(), dv.end() );
    dv.push_back ( 1e8 );
  //  cout << dv.size() << endl;

    for ( int i = 0; dv[i] * dv[i] * dv[i] <= p; ++i )
        if ( p % dv[i] == 0 ){
            long long x = p / dv[i];
            for ( int j = i; dv[j] * dv[j] <= x; ++j )
                if ( x % dv[j] == 0)
                    v.push_back ( triplet ( dv[i], dv[j], x / dv[j] ) );
        }
}

int ok ( triplet t ){
    long long x = t.x, y = t.y, z = t.z;
    if ( ( x + y - z ) & 1 )
        return 0;
    long long a = ( x + y - z ) / 2, b = ( x - y + z ) / 2, c = ( y + z - x ) / 2;
   // cout << a << " " << b << " " << c << endl;
    if ( a <= 0 )
        return 0;
    if( b <= 0 )
        return 0;
    if ( c <= 0 )
        return 0;

    if ( a == b && b == c )
        return 1;

    if ( a != b && b != c && c != a )
        return 6;
    return 3;
}

void solve(){
    if ( N % 3 ){
        cout << 0 << endl;
        return;
    }
    generateTriplets(N/3);

    int res = 0;

    for ( int i = 0; i < v.size(); ++i )
        res += ( ok ( v[i] ) );

    cout << res << endl;
}

int main(){
    scan();
    solve();
}

#include <iostream>

#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <vector>

#include <algorithm>

using namespace std;

#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)

#define FOR(a, b, c) for(int a = b; a <= c; a++)
#define FORD(a, b, c) for(int a = b; a >= c; a--)
#define REP(a, b, c) for(int a = b; a < c; a++)
#define REPD(a, b, c) for(int a = b - 1; a >= c; a--)

#define FORP(a, b) for(__typeof (b.begin ()) a = b.begin (); a != b.end (); a++)
#define FORS(a, b) for(int a = 0; a < (int) b.size (); a++)

#define SIZE(a) a.begin (), a.end ()

#define fill(a, b) memset (a, b, sizeof (a))

#define F first
#define S second

typedef long long LL;
typedef pair <int, int> pii;
typedef pair <int, pii> p3i;
typedef pair <pii, pii> p4i;

const int MAXINT = 1111 * 1111 * 1111;
const long long MAXLINT = MAXINT * 1ll * MAXINT;
const long double EPS = 1e-10;

#define FILE_NAME "io"

LL n;

int e;
LL del[1000000];

int main()
{
    #ifndef ONLINE_JUDGE
    freopen (FILE_NAME".in", "r", stdin);
    freopen (FILE_NAME".out", "w", stdout);
    #endif // ONLINE_JUDGE

    scanf ("%I64d", &n);

    // n/3 = (a + b) (a + c) (b + c)

    LL ans = 0;
    if (n % 3 == 0) {
        n /= 3;

        // (a + b) (a + c) >= (b + c) (b + c)

        // n/3 >= (b + c) * (b + c) * (b + c)

        for (LL i = 1; i * i * i <= n; i++) if (n % i == 0)
            del[e++] = i;

        int p = 0;
        for (LL c = 1; 8 * c * c * c <= n; c++) {
            for (; p < e && del[p] - c < c; p++);
            for (int i = p; i < e; i++) {
                LL b = del[i] - c;

                if ((b + b) * (b + c) * (b + c) > n) continue;

                LL D = (b - c) * (b - c) + 4 * n / (b + c);
                LL DD = sqrt (D + 0.0);

                while (DD * DD > D) DD--;
                while (DD * DD < D) DD++;

                if (DD * DD != D) continue;

                LL a = - b - c + DD;

                if (a & 1) continue;

                a >>= 1;

                if (a < b) continue;

                if (b == c) {
                    if (a == b) ans++; else
                        ans += 3;
                } else {
                    if (a == b) ans += 3; else
                        ans += 6;
                }
            }
        }
    }

    printf ("%I64d", ans);

    return 0;
}

#include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>

#include <ctime>
#include <deque>
#include <bitset>
#include <cctype>
#include <utility>
#include <cassert>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)
#define Fit(i,v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define Fitd(i,v) for(__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))

template<class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T r; ss >> r; return r; }
template<class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sqr(T x) { return x * x; }
template<class T> T cube(T x) { return x * x * x; }
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return s == 0 ? 0 : cntbit(s >> 1) + (s & 1); }
const int bfsz = 1 << 16; char bf[bfsz + 5]; int rsz = 0;int ptr = 0;
char gc() { if (rsz <= 0) { ptr = 0; rsz = (int) fread(bf, 1, bfsz, stdin); if (rsz <= 0) return EOF; } --rsz; return bf[ptr++]; }
void ga(char &c) { c = EOF; while (!isalpha(c)) c = gc(); }
int gs(char s[]) { int l = 0; char c = gc(); while (isspace(c)) c = gc(); while (c != EOF && !isspace(c)) { s[l++] = c; c = gc(); } s[l] = '\0'; return l; }
template<class T> bool gi(T &v) {
    v = 0; char c = gc(); while (c != EOF && c != '-' && !isdigit(c)) c = gc(); if (c == EOF) return false; bool neg = c == '-'; if (neg) c = gc();
    while (isdigit(c)) { v = v * 10 + c - '0'; c = gc(); } if (neg) v = -v; return true;
}

#define maxn 2000005
#define mod 1000000007

ll n;
vector<ll> V;
ll a, b, c;

int calcu(){
    if(c > a) return 0;
    if((a + b + c) * (a + b + c) * (a + b + c) - a * a * a - b * b * b - c * c * c != n) {
        return 0;
    }
    if(a == b && a == c) return 1;
    if(a == b) return 1;
    if(a == c) return 2;
    return 3;
}

int main(){
//  freopen("in.txt", "r", stdin);

    cin >> n;
    if(n % 3){
        cout << 0;
        return 0;
    }
    ll N = n / 3 * 4;

    for(int i = 2; i * 1ll * i <= N; i++) if(N % i == 0){
        if(i * 1ll * i == N) V.pb(i);
        else {
            V.pb(i); V.pb(N / i);
        }
    }

    sort(all(V));
    int run = 0;
    ll res = 0;
    for(a = 1; a * a * 6 <= n; a++){
        if(24 * a * a < n / a) continue;
        while(V[run] <= a) run++;
        for(int u = run;;u++){
            b = V[u] - a;
            if(b > a || 3 * a * a * b > n ) break;
            ll d = (a - b) * (a - b) + N / (a + b);
            ll x = (ll)sqrt(d + 0.5);
            if(x * x != d) continue;
            if((x - a - b) > 0 && !((x - a - b)&1)){
                c = (x - a - b) >> 1;
                res += calcu();
            }

        }
    }
    cout << res << endl;
//    cout << clock() << endl;

    return 0;
}

#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <cmath>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-7
#define maxm 200000000
#define MAXN 33
#define inf 1000000000
//const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi 3.1415926535
using namespace std;
__int64 a[1000000];
int l;
void get(__int64 n)
{
      __int64 k=(__int64)sqrt((double)n);
      __int64 i;
      l=0;
      for (i=2;i<=k;i++)
      {
          if (n%i==0)
          {
              a[l++]=i;
          }
      }
}
int main()
{
    //freopen("E:\\in.txt","r",stdin);
    //freopen("E:\\out.txt","w",stdout);
    __int64 n;
   while(scanf("%I64d",&n)!=EOF)
   {
    if (n%3)
    {
        printf("0\n");
        continue;
    }
    n/=3;
    get(n);
    //printf("%d\n",l);
    __int64 x,y,z;
     int i,j;
     int ans=0;
     for (i=0;i<l;i++)
     {
         for (j=i;j<l;j++)
         {
            x=a[i];
            y=a[j];
            z=n/x;
            if(z%a[j]) continue;
            z/=a[j];
            if(z<y) break;
            if((x+y-z)<=0||(x+y-z)%2==1) continue;
            if((x+z-y)<=0||(x+z-y)%2==1) continue;
            if((z+y-x)<=0||(y+z-x)%2==1) continue;
            //if(n==1260/3) printf("%I64d %I64d %I64d\n",x,y,z);
            if(a[i]==a[j]&&a[i]==z)
            ans++;
            else if(x==y||x==z||y==z)
            {
                 ans+=3;
            }
            else ans+=6;
         }
     }
     printf("%d\n",ans);
   }
    return 0;
}

#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#define MAXL 1000005
using namespace std;

/*
假设a <= b <= c
有 n/3 = a^2(b+c) + b^2(a+c) + c^2(a+c) + 2*abc
*/
int main() {
	long long n, cnt = 0;
	cin >> n;
	if(n % 3 != 0) {
		puts("0");
		return 0;
	}
	n /= 3;
	for(long long i = 1; i * i * i <= n; ++i) {
		if(n % i != 0)
			continue;
		long long rem = n / i;
		for(long long j = (long long)floor(sqrt(rem)); j >= 1; --j) {
			long long k = rem / j;
			if(i > j || i + j <= k)
				break;
			if(rem % j != 0)
				continue;
			if((i % 2 + j % 2 + k % 2) % 2 == 0) {
			//	printf("%I64d %I64d %I64d\n", i, j, k);
				if(i == j && j == k) {
					++cnt;
				}
				else if(i == j || j == k || i == k) {
					cnt += 3;
				}
				else {
					cnt += 6;
				}
			}
		}
	}
	printf("%I64d\n", cnt);
	return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <string.h>
#include <ctime>
#include <limits.h>
using namespace std;

typedef long long ll;
const double pi=acos(-1.0);
const double eps=1e-11;
//const ll INF=(_I64_MAX)/2;
//#pragma comment(linker, "/STACK:102400000,102400000")
const int inf=0x3f3f3f3f;
#define maxx(a) memset(a, 0x3f, sizeof(a))
#define zero(a) memset(a, 0, sizeof(a))
template<class T>void show(T a, int n){for(int i=0; i<n; ++i) cout<<a[i]<<' '; cout<<endl;}
template<class T>void show(T a, int r, int l){for(int i=0; i<r; ++i)show(a[i],l);cout<<endl;}
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define srep(i,n) for(i = 1;i <= n;i ++)
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define MP make_pair
typedef pair<int,int> PII;

const int N = 1e5+ 111;
inline ll get(ll a,ll b,ll c){
    return a*b*b+a*a*b+a*c*c+a*a*c+b*c*c+b*b*c+2*a*b*c;
}
ll n;
ll ans;
void doit(ll i,ll j)
{
    ll t1 = i + j;
    ll t2 = (i + j) * (i + j);
    ll t3 = i * j * j + i * i * j - n;
    if(get(i,j,j) -n > 0) return;
    //cout<<i<<' '<<j<<endl;
    ll dt = t2*t2 - 4*t1*t3;
    if(dt >= 0){
        ll dd = sqrt(dt*1.0);
        if(dd * dd == dt){
            ll ac = (dd - t2)/2/t1;
            if(ac < j) return;
            if( get(i,j,ac) == n ){
                //cout<<i<<' '<<j<<' '<<ac<<endl;
                if(i == j && j == ac)
                    ans ++;
                else if(i == j || j == ac)
                    ans += 3;
                else ans += 6;
            }
        }
    }
    else return;
}
int main()
{
#ifndef ONLINE_JUDGE
   //freopen("in.txt","r",stdin);
  // freopen("out.txt","w",stdout);
#endif

    while(~scanf("%I64d",&n)){
        ll i,j,ii,jj;
        ans = 0;
        if(n % 3){
            puts("0");
            continue;
        }
        n /= 3;
        ll X = 16000+25000;
        REP(ii,2,X){
            if(n % ii == 0){
                srep(i,ii/2){
                    j = ii - i;
                    doit(i,j);
                }
            }
        }
        printf("%I64d\n",ans);
    }

#ifndef ONLINE_JUDGE
    cerr << "time = " << clock() << " ms" << endl;
#endif

return 0;
}

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
vector<long long>vec;
int main(){
	long long r;
	scanf("%lld",&r);
	if(r%3!=0){
		puts("0");
		return 0;
	}
	r/=3;
	for(long long i=1;i*i<=r;i++){
		if(r%i==0){
			vec.pb(i);
			if(i*i!=r){
				vec.pb(r/i);
			}
		}
	}
	sort(vec.begin(),vec.end());
	int ret=0;
	for(long long i=1;i*i*i<=r;i++){
                if(r%i!=0) continue;
		long long s;
		s=r/i;
		int F=lower_bound(vec.begin(),vec.end(),i)-vec.begin();
		for(int d=F;;d++){
			if(vec[d]*vec[d]>s){
				break;
			}
			if(s%vec[d]==0){
				long long a,b,c,D,e,f;
				a=i;
				b=vec[d];
				c=s/vec[d];
				if((a+b+c)%2==0 && a+b>c){
					D=(a+b+c)/2-a;
					e=(a+b+c)/2-b;
					f=(a+b+c)/2-c;
					if(D==f){
						ret++;
					}else if((D==e) || (e==f)){
						ret+=3;
					}else{
						ret+=6;
					}
				}
			}
		}
	}
	printf("%d\n",ret);
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <ctime>
#include <numeric>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <complex>
#include <deque>
#include <functional>
#include <list>
#include <map>
#include <string>
#include <sstream>
#include <set>
#include <stack>
#include <queue>
using namespace std;
template<class T> inline T sqr(T x) { return x * x; }
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<PII, int> PIII;
typedef pair<LL, LL> PLL;
typedef pair<LL, int> PLI;
typedef pair<LD, LD> PDD;
#define MP make_pair
#define PB push_back
#define sz(x) ((int)(x).size())
#define clr(ar,val) memset(ar, val, sizeof(ar))
#define istr stringstream
#define FOR(i,n) for(int i=0;i<(n);++i)
const double EPS = 1e-6;
const int INF = 0x3fffffff;
const LL LINF = INF * 1ll * INF;
const double PI = acos(-1.0);

using namespace std;

LL ans = 0;
vector<LL> v;

void find(int id,LL x,LL y){
    for(int i = 0;i<v.size();i++){
        if(y%v[i]==0){
            LL z = y/v[i];
            LL w = v[i];
            if((w+z-x)%2!=0) continue;
            LL c = (w+z-x)/2;
            LL b = w-c;
            LL a = x-b;
            if(a>0&&b>0&&c>0) ans++;
        }
    }
}

int main(void){
      //freopen("","r",stdin);
      LL n;
      cin>>n;
      if(n%3!=0){
          cout<<0<<endl;
          return 0;
      }
      n/=3;
      LL sq_n = sqrt(n+0.5);
      for(LL i = 2;i*i<=n;i++){
          if(n%i==0) v.PB(i);
      }
      for(int i = 0;i<v.size();i++){
          if(v[i]%2&&n/v[i]%2) continue;
          find(i,v[i],n/v[i]);
      }
      cout<<ans<<endl;
}

/* -*- coding: utf-8 -*-
 *
 * 0293C.cc: C. Cube Problem
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

/*
  (a+b+c)^3 = (a^2+b^2+c^2+2ab+2bc+2ac)(a+b+c)
  = a^3+ab^2+ac^2+2a^2b+2abc+2a^2c
    +a^2b+b^3+bc^2+2ab^2+2b^2c+2abc+
    +a^2c+b^2c+c^3+2abc+2bc^2+2ac^2
  = a^3+b^3+c^3+3a^2b+3a^2c+3ab^2+3b^2c+3ac^2+3bc^2+6abc
  -> (a+b+c)^3-(a^3+b^3+c^3)
  = 3a^2b+3a^2c+3ab^2+3b^2c+3ac^2+3bc^2+6abc
  = 3(a^2b+a^2c+ab^2+b^2c+ac^2+bc^2+2abc)
  = 3(a^2(b+c)+a(b^2+c^2+2bc)+bc(b+c))
  = 3(b+c)(a^2+a(b+c)+bc)
  = 3(a+b)(b+c)(c+a)

  let a<=b<=c, x=a+b,y=a+c,z=b+c -> x<=y<=z
  -> a=(x+y-z)/2, b=(x+z-y)/2, c=(y+z-x)/2
 */

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  ll n;
  scanf("%lld", &n);
  if (n % 3 != 0) {
    puts("0");
    return 0;
  }
  n /= 3;

  ll sum = 0;
  for (ll x = 2; x * x * x <= n; x++)
    if (n % x == 0) {
      ll m = n / x;
      // y*(y+x)=m ->y^2+xy-m=0 ->y=(-x+-sqrt(x^2+4m))/2
      double yy = 0.5 * (-x+sqrt(x * x + 4.0 * m));
      ll miny = max((ll)yy, x);
      for (ll y = miny; y * y <= m; y++)
	if (m % y == 0) {
	  ll z = m / y;
	  //printf("x=%lld,y=%lld,z=%lld\n", x, y, z);

	  ll a2 = (x + y - z);
	  ll b2 = (x + z - y);
	  ll c2 = (y + z - x);
	  if (a2 > 0 && b2 > 0 && c2 > 0 &&
	      ! (a2 & 1) && ! (b2 & 1) && ! (c2 & 1)) {
	    if (a2 < b2 && b2 < c2) sum += 6;
	    else if (a2 == b2 && b2 < c2) sum += 3;
	    else if (a2 < b2 && b2 == c2) sum += 3;
	    else sum++;
	  }
	}
    }

  printf("%lld\n", sum);
  return 0;
}

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;

LL n,ans;

LL Max(LL a1,LL a2)
{
    return a1>a2?a1:a2;
}

int main()
{
    while (~scanf("%I64d",&n))
    {
        if (n%3)
        {
            printf("0\n");
            continue;
        }
        n/=3;
        ans=0;
        for (LL i=2;i*i*i<=n;i++)
        {
            if (n%i) continue;
            LL ni=n/i;
            LL u2=(LL)sqrt((long double)ni*4+i*i);
            u2=Max(i,(u2-i)/2);
            for (LL j=u2;j*j<=ni;j++)
            {
                if (ni%j) continue;
                LL k=ni/j;
                if (k<j) continue;
                if ((i+j+k)%2) continue;
                if ((i+j)<=k) continue;
                if (i==k) ans++;
                else if (i==j||j==k) ans+=3;
                else ans+=6;
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}

#include<algorithm>
#include <iostream>
#include <vector>

using namespace std;
struct triplet{
    long long x, y, z;
    triplet(){};
    triplet ( long long x, long long y, long long z ){
        this->x = x;
        this->y = y;
        this->z = z;
    }

    bool operator<( triplet t1 )const{
        if ( t1.x == x )
            if ( t1.y == y )
                return z < t1.z;
            else
                return y < t1.y;
        else
            return x < t1.x;
    }
};
long long N, res = 0;
vector <triplet> v;
long long dv[1 << 17];
int sz = 0;
void scan(){
    cin >> N;
}

inline int ok ( triplet t ){
    long long x = t.x, y = t.y, z = t.z;
    if ( ( x + y - z ) & 1 )
        return 0;
    long long a = ( x + y - z ) / 2, b = ( x - y + z ) / 2, c = ( y + z - x ) / 2;
   // cout << a << " " << b << " " << c << endl;
    if ( a <= 0 || b <= 0 || c <= 0 )
        return 0;
    if ( a == b && b == c )
        return 1;

    if ( a != b && b != c && c != a )
        return 6;
    return 3;
}

void generateTriplets ( long long p ){
    for ( long long i = 1; i * i <= p; ++i )
        if ( p % i == 0 ){
            dv[sz++] = ( i );
        }
    dv[sz++] = ( 1e8 );
  //  cout << dv.size() << endl;

    for ( int i = 0; dv[i] * dv[i] * dv[i] <= p; ++i )
        if ( p % dv[i] == 0 ){
            long long x = p / dv[i];
            for ( int j = i; dv[j] * dv[j] <= x; ++j )
                if ( x % dv[j] == 0 )
                    res += ok ( triplet ( dv[i], dv[j], x / dv[j] ) );
        }
}

void solve(){
    if ( N % 3 ){
        cout << 0 << endl;
        return;
    }
    generateTriplets(N/3);
    cout << res << endl;
}

int main(){
    scan();
    solve();
}

#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define INPUT freopen("c.inp","r",stdin)
#define OUTPUT freopen("c.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) for(auto i=l;i>r;i--)
#define ENDL printf("\n")
#define debug 1

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,int> lli;

const int inf=1e9;
const int MOD=1e9+7;
const int N=6e6;

int t[N+10];
ll n,cur;
vector <int> pri;
vector <lli> a;
vector <ll> b;
ll cube(ll x){
    return x*x*x;
}
void DP(int x){
    if (x==a.size()){
        b.push_back(cur);
        return;
    }
    FOR(i,0,a[x].Y){
        DP(x+1);
        if (i<a[x].Y) cur*=a[x].X;
    }
    FOR(i,1,a[x].Y) cur/=a[x].X;
}
int main(){
    FOR(i,2,N) if (!t[i]){
        pri.push_back(i);
        for(ll j=1LL*i*i;j<=N;j+=i) t[j]=i;
    }
    cin>>n;
    ll ans=0;
    if (n%3==0){
        n/=3;
        ll tmp=n;
        for(auto i:pri) {
            if (1LL*i*i>n) break;
            if (n%i==0){
                int c=0;
                while (n%i==0) n/=i,c++;
                a.push_back(lli(i,c));
            }
        }
        if (n>1) a.push_back(lli(n,1));
        n=tmp;
        //for(auto i:a) printf("%lld %d\n",i.X,i.Y);
        cur=1;
        DP(0);
        //
        sort(b.begin(),b.end());
        int m=b.size();
        //for(auto i:b) printf("%lld\n",i);
        //cout<<n<<'\n';
        for(int i=0;i<m&&cube(b[i])<=n;i++)
            for(int j=i;j<m&&b[i]*b[j]*b[j]<=n;j++) if (n%(b[i]*b[j])==0){
                //cout<<b[i]<<" "<<b[j]<<" "<<n/(b[i]*b[j])<<" ";
                //ll z=n/(b[i]*b[j])-b[i]+b[j],x=b[j]-z,y=b[i]-x;
                ll x=b[i]+b[j]-n/(b[i]*b[j]);
                if (x%2) continue;x>>=1;
                ll y=b[i]-x,z=b[j]-x;
                //cout<<x<<" "<<y<<" "<<z<<'\n';
                if (x<=0||y<=0||z<=0) continue;
                if (x==y){
                    if (z==x) ans++;
                    else ans+=3;
                }else{
                    if (y==z) ans+=3;
                    else ans+=6;
                }
            }
    }
    cout<<ans;
}

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <iomanip>

using namespace std;

#define pb push_back

#ifdef HOME
ifstream in("input.txt");
ofstream out("output.txt");
#else
#define in cin
#define out cout
#endif

long long qrt(long long x2)
{
    long long x = sqrt((long double) x2);
    long long xx = x * x;
    if (xx < x2) {
        while (x * x < x2) {
            ++x;
        }
    } else if (xx > x2) {
        while (x * x > x2) {
            --x;
        }
    }
    if (x * x == x2) {
        return x;
    }
    return -1;
}

int main()
{
    long long n;
    in >> n;
    if (n % 3 != 0) {
        out << 0 << endl;
        return 0;
    }
    long long ans = 0;
    n /= 3;
    long long X = pow(n, 0.5) + 100;
    while (X * X > n) {
        --X;
    }
    /*for (long long x = 2; x <= X; ++x) {
        if (n % x) {
            continue;
        }
        long long C
        for (int c = 1; c < x)
            long long y = n / x - cc - c * x;
            if (y < x - 1 || y < cc) {
                break;
            }
            long long D2 = x * x - 4 * y;
            if (D2 < 0) {
                continue;
            }
            long long D = qrt(D2);
            if (D == -1) {
                continue;
            }
            long long b = x - D;
            if (b % 2 != 0) {
                continue;
            }
            b /= 2;
            if (b < c) {
                continue;
            }
            //long long a = b + D;
            int diff = 1 + (D != 0) + (b != c);
            if (diff == 1) {
                ans += 1;
            } else if (diff == 3) {
                ans += 6;
            } else {
                ans += 3;
            }
        }
    }*/
    int C = pow(n / 8.0, 1.0 / 3) + 100;
    while (8ll * C * C * C > n) {
        --C;
    }
    vector<int> del;
    for (int x = 1; x <= X; ++x) {
        if (n % x == 0) {
            del.pb(x);
        }
    }
    for (int c = 1; c <= C; ++c) {
        long long cc = c * c, c2 = c + c;
        for (long long x : del) {
            if (x < c2) {
                continue;
            }
            long long y = n / x - cc - c * x;
            if (y < x - 1 || y < cc) {
                break;
            }
            long long D2 = x * x - 4 * y;
            if (D2 < 0) {
                continue;
            }
            long long D = qrt(D2);
            if (D == -1) {
                continue;
            }
            long long b = x - D;
            if (b % 2 != 0) {
                continue;
            }
            b /= 2;
            if (b < c) {
                continue;
            }
            //long long a = b + D;
            int diff = 1 + (D != 0) + (b != c);
            if (diff == 1) {
                ans += 1;
            } else if (diff == 3) {
                ans += 6;
            } else {
                ans += 3;
            }
        }
    }
    out << ans << endl;

    return 0;
}

#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#define rep(i,j,k) for(int i=j;i<=k;i++)
#define lowbit(x) ((x)&(-(x)))
using namespace std;
typedef long long LL;
LL n;LL ans=0;
void check(LL ab,LL bc,LL ac)
{
	if((ab+bc+ac)%2==1)return;
	LL abc=(ab+bc+ac)/2;
	LL a=ab+ac-abc;
	LL b=ab+bc-abc;
	LL c=bc+ac-abc;
	if(a<=0||b<=0||c<=0)return;
	if(a==b&&b==c)
	{
		ans++;return;
	}
	if(a==b||b==c||a==c)
	{
		ans+=3;return;
	}
	ans+=6;
}
int main()
{
	scanf("%I64d",&n);
	if(n%3!=0)
	{
		printf("0\n");
		return 0;
	}
	n/=3;
	for(LL a=1;a*a*a<=n;a++)
	if(n%a==0)
	{
	for(LL b=(LL)sqrt(n/a);b>=a;b--)
	if((n/a)%b==0)
	{
		LL c=(n/b)/a;
		if(a+b<=c)break;
		if(c>=b)
		check(a,b,c);
	}
	}
	printf("%I64d\n",ans);
	return 0;
}

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define IN(x,y) ((y).find((x))!=(y).end())
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

typedef vector<pair<ll,int> > Roz;
Roz rozklad (ll x) { // rozklad: {<liczba pierwsza, krotnosc>}
   Roz res;
   for (int d = 2; (ll)d*d <= x; ++d) {
      if (x % d == 0) {
         int k = 0;
         while (x % d == 0) { x /= d; ++k; }
         res.pb(mp(d,k));
      }
   }
   if (x != 1) res.pb(mp(x,1));
   return res;
}

int main () {
   ll n;
   cin >> n;
   if (n % 3) { pisz(0); return 0; }
   n /= 3;
   /*vector<ll> divs;
   ll k;
   for (k = 1; k*k < n; ++k) if (n % k == 0) { divs.pb(k); divs.pb(n/k); }
   if (k*k == n) divs.pb(k);
   sort(ALL(divs));

   int res = 0;
   FOREACH(aa,divs) {
      ll a = *aa;
      //DBG(a)
      FOREACH(bb,divs) {
         ll b = *bb;
         if (a*b > n) break;
         if (n % (a*b)) continue;
         ll c = n/a/b;
         if (1 & (a+b+c)) continue;
         if (a+b>c && a+c>b && b+c>a) ++res;
      }
   }*/
   Roz roz = rozklad(n);

   int res = 0;
   int m = SZ(roz);
   vi v(m,0);
   while(1) {
      vi w(m,0);
      while(1) {
         // rob cos z v i w
         ll a=1,b=1;
         FOR(j,m) {
            FOR(u,v[j]) a *= roz[j].fi;
            FOR(u,w[j]) b *= roz[j].fi;
         }
         ll c =  n/a/b;
         if ((a+b+c) % 2 == 0) if (a+b>c && a+c>b && b+c>a) ++res;

         int j = 0;
         while (j < m) {
            w[j]++;
            if (w[j] > roz[j].se-v[j]) {
               w[j] = 0;
               j++;
            } else break;
         }
         if (j == m) break;
      }

      int j = 0;
      while(j < m) {
         v[j]++;
         if (v[j] > roz[j].se) {
            v[j] = 0;
            j++;
         } else break;
      }
      if (j == m) break;
   }
   pisz(res);
}

#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <map>
using namespace std;

long long n,i,answer,m,apb,apc,bpc,same;
vector <long long> v;
int k,j;

main()
{
 cin>>n;

 if ( n%3LL )
  {
   cout<<0<<endl;
   return 0;
  }

 // n=3(a+b)(b+c)(a+c)

 n/=3LL;

 for ( i=2LL;i*i<=n;i+=1LL )
  if ( n%i==0LL )
   {
    v.push_back(i);
    if ( (i*i)!=n )
     v.push_back(n/i);
   }
 sort(v.begin(),v.end());

 for ( j=0;j<v.size() && v[j]*v[j]*v[j] <= n;j++ )
  {
   apb=v[j];
   m=n/apb;
   for ( k=0;k<v.size() && v[k]*v[k]<=m; k++ )
    if ( m%v[k]==0LL )
     if ( (m/v[k])>1LL )
     {
      apc=v[k];
      bpc=m/v[k];
      if ( apb<=apc && apc<=bpc )
       if ( (apb+apc)>bpc )
       if ( (apb+apc+bpc)%2LL==0LL )
       {
        if ( apb==apc && apc==bpc ) answer+=1LL;
        else if ( apb==apc ) answer+=3LL;
        else if ( apc==bpc ) answer+=3LL;
        else answer+=6LL;
       }
     }
  }

 cout<<answer<<endl;
 //system("pause");

 return 0;
}

//Written by technolt~h

#pragma comment(linker, "/STACK:16777216")
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
 #include <stack>
#include <set>
#include <map>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <memory.h>
#include <sstream>
 #include <complex>

#define REP(i,n) for(int i = 0, _n = (n); i < _n; i++)
#define REPD(i,n) for(int i = (n) - 1; i >= 0; i--)
#define FOR(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define FORD(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
 #define FORN(i,a,b) for(int i=a;i<b;i++)
#define FOREACH(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define RESET(c,x) memset (c, x, sizeof (c))

#define sqr(x) ((x) * (x))
#define PB push_back
 #define MP make_pair
#define F first
#define S second
#define Aint(c) (c).begin(), (c).end()
#define SIZE(c) (c).size()

#define DEBUG(x) { cerr << #x << " = " << x << endl; }
#define PR(a,n) {cerr<<#a<<" = "; FOR(_,1,n) cerr << a[_] << ' '; cerr <<endl;}
#define PR0(a,n) {cerr<<#a<<" = ";REP(_,n) cerr << a[_] << ' '; cerr << endl;}
#define LL long long

using namespace std;

LL n;

LL p[100000];
int cs[100000], np;
LL res;

void update(LL z, LL y, LL x) {
    if (z >= y && y >= x && ((x + y + z) % 2 == 0) && z < y + x) {
        //cerr <<z << " " << y << " " << x << endl;
        LL p = (x + y + z)/2;
        LL a = p - x;
        LL b = p - y;
        LL c = p - z;

        if (a < b) swap(a, b);
        if (a < c) swap(a, c);
        if (b < c) swap(b, c);

        if (a == b && b == c) res++;
        else if (a == b) res += 3;
        else if (b == c) res += 3;
        else res += 6;
    }
}

void findY(int i, LL y, LL z) {
    if (y > z) return;

    if (i == np + 1) {
        update(z, y, n / y / z);
        return;
    }

    LL t = 1;
    FOR (cnt, 0, cs[i]) {
        cs[i] -= cnt;
        findY(i + 1, y * t, z);
        cs[i] += cnt;
        if (cnt != cs[i]) t *= p[i];
    }

}

void findZ(int i, LL z) {
    if (i == np + 1) {
        findY(1, 1, z);
        return;
    }

    LL t = 1;
    FOR (cnt, 0, cs[i]) {
        cs[i] -= cnt;
        findZ(i + 1, z * t);
        cs[i] += cnt;
        if (cnt != cs[i]) t *= p[i];
    }
}

int main() {
    //freopen("a.in", "r", stdin);
    cin >> n;

    if ((n % 3)) {
        cout << 0;
        return 0;
    }

    n/=3;
    LL T = n;

    FOR (i, 2, sqrt(n) + 10)
        if ((T % i) == 0) {
            p[++np] = i;
            while ((T % i) == 0) {
                cs[np] ++;
                T /= i;
            }
        }

    if (T > 1) {
        p[++np] = T;
        cs[np]  = 1;
    }

    //FOR (i, 1, np) cerr <<p[i] << " " << cs[i] << endl;

    res = 0;
    findZ(1, 1);

    cout << res;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

ll cnt;

void dod(ll x, ll y, ll z) {
	if (x == y && y == z)
		cnt += 1;
	else if (x == y || y == z || x == z)
		cnt += 3;
	else
		cnt += 6;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	if (n % 3) {
		cout << "0\n";
		return 0;
	}

	n /= 3;

	basic_string<int> small_divs;
	for (int x=1; x<=40000; x++)
		if (4*n % x == 0)
			small_divs += x;

	for (ll a=1; a<=18000; a++) {
		// cerr << "a: " << a << '\n';
		for (ll x : small_divs) {
			ll b = x - a;
			if (b < a)
				continue;
			ll q = sqrt((ld)(a-b)*(a-b) + (ld)4.0*n / (a+b));
			/*
			if ((q-a-b) / 2 < 0.999 * b) {
				cerr << "a: " << a << ", b: " << b << '\n';
				// break;
			}
			*/

			ll c = round(q);
			if (4*n % (a+b) || c*c != (a-b)*(a-b) + 4*n / (a+b))
				continue;
			c -= a+b;
			if (c % 2 == 0 && (c >> 1) >= b)
				dod(a, b, c >> 1);
		}
	}

	cout << cnt << '\n';
}

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <queue>
#include <deque>
#include <cmath>
#include <string>
#include <cstring>
#define mk make_pair
#define ll long long
using namespace std;
ll n;
vector <ll>v;
int main()
{
    ios_base::sync_with_stdio (false);
    //freopen ("input.txt","r",stdin);
    //freopen ("output.txt","w",stdout);
    cin>>n;
    if(n%3!=0)
    {
        cout<<"0"<<endl;
        return 0;
    }
    n/=3;
    for(ll i=1;i*i<=n;i++)
        if(n%i==0)
            v.push_back(i);
    ll ans=0;
    sort(v.begin(),v.end());
    //cout<<v.size()<<endl;
    for(int i=0;i<v.size();i++)
        for(int j=i;j<v.size();j++)
        {
            ll x=v[i],y=v[j];
            if(n%(x*y)!=0)
                continue;
            ll z=n/(x*y);
            ll v1=(x+y-z)/2,v2=(x+z-y)/2,v3=(z+y-x)/2;
            if((v1+v2+v3)*2!=x+y+z || v1<=0 || v2<=0 || v3<=0 || v1>v2 || v2>v3)
                continue;
            if(v1==v2 && v2==v3)
            {
                ans++;
                continue;
            }
            if(v1==v2 || v2==v3)
            {
                ans+=3;
                continue;
            }
            ans+=6;
        }
    cout<<ans<<endl;

    return 0;
}

#pragma comment(linker, "/stack:256000000")

#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <cassert>
#include <queue>

using namespace std;

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()

long long d[1000000];
int cnt;

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	long long start = clock();
#endif
	long long n;
	cin >> n;
	if (n % 3 != 0) {
		puts("0");
		return 0;
	}
	n /= 3;
	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			d[cnt++] = i;
			//if (i * i != n) {
			//	d[cnt++] = n / i;
			//}
		}
	}
	sort(d, d + cnt);
	long long d1, d2, d3, x1, x2, x3, res = 0;
	REP(i, cnt) REP(j, cnt) {
		d1 = d[i];
		d2 = d[j];
		if (d1 * d2 > n) break;
		if (n % (d1 * d2) == 0) {
			d3 = n / (d1 * d2);
			if (d2 + d3 - d1 > 0 && (d2 + d3 - d1) % 2 == 0) {
				x3 = (d2 + d3 - d1) / 2;
				x2 = d3 - x3;
				x1 = d1 - x2;
				if (x1 > 0 && x2 > 0) {
					++res;
				}
			}
		}
	}
	cout << res;
#ifdef LOCAL
	fprintf(stderr, "\n\nTime: %.3lf\n\n", (clock() - start) / 1000.);
#endif
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  ll n; cin >> n;
  if (n % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  n /= 3;
  if (n % 2 != 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<ll> divisors;
  for (ll i = 1; i * i <= n; i ++) {
    if (n % i == 0) divisors.push_back(i);
  }
  ll c = 0;
  for (ll r = 1; r * r * r <= n; r ++) {
    if (n % r != 0) continue;
    auto it = divisors.begin();
    ll l = *it;
    while (it != divisors.end() && r * l * l <= n) {
      if (l < r) {
              advance(it, 1);
              l = *it;
              continue;
      }
      if (n % (r * l) != 0) {      advance(it, 1);
      l = *it; continue;}
      ll t = n / (r * l);
      if (r > l || l > t) {      advance(it, 1);
      l = *it; continue;}
      if ((r + l + t) % 2 != 0) {      advance(it, 1);
      l = *it;continue;}
      ll u = (r + l + t) / 2;
      ll x = u - t;
      ll y = u - l;
      ll z = u - r;
      if (x > 0 && y > 0 && z > 0) {
        if (x != y && y != z) c += 6;
        else if ((x == y && y != z) || (x != y && y == z)) c += 3;
        else c ++;
      }
      advance(it, 1);
      l = *it;
    }
  }
  cout << c << endl;
}

#include<bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    long long n;
    cin>>n;

    if (n%6)    {
        cout<<0<<endl;
        return 0;
    }

    n/=3;

    vector<long long> divs;
    for (int i=1; 1LL*i*i<=n; i++) {
        if (n%i)    continue;
        divs.push_back(i);
        if (n/i!=i) divs.push_back(n/i);
    }

    sort(divs.begin(), divs.end());

    long long ans = 0;
    for (int i=0; i<divs.size(); i++) {
        long long a = divs[i];
        long long na = n/a;
        if (a > na || a*a > na)  break;

        for (int j=i; j<divs.size(); j++) {
            long long b = divs[j];
            if (b > na || b*b > na)  break;
            if (na%b)   continue;
            long long c = na/b;

            if ((a+b+c)%2 || c >= a+b || c < b)  continue;
            long long H = (a+b+c)/2;
            long long x = H-a;
            long long y = H-b;
            long long z = H-c;

            int cc = (x==y) + (y==z);
            if (cc == 0)    ans += 6;
            else if (cc == 1)    ans += 3;
            else if (cc == 2)    ans++;
        }
    }
    cout<<ans<<endl;

}

#include<bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
typedef long long int ll;
typedef double lf;

const int inf = 987654321;
const ll INF = 123456789987654321;

#define pb push_back
#define rs resize
#define cl clear

ll N;
vector<ll> d;
int main() {
    scanf("%I64d", &N);
    if(N%3) printf("0");
    else {
        N/=3;
        for(ll i = 1; i <= sqrt(N); i++) {
            if(N%i==0) {
                d.pb(i);
                if(i*i==N) d.pb(N/i);
            }
        }

        ll cnt = 0;
        for(int i = 0; i < d.size(); i++) {
            ll a = d[i];
            for(int j = 0; j < d.size(); j++) {
                ll b = d[j];
                if(N%(a*b)) continue;
                ll c = N/(a*b);
                if(a+b<=c||b+c<=a||c+a<=b) continue;
                if((a+b+c)%2) continue;
                cnt++;
            }
        }
        printf("%I64d", cnt);
    }
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>

using namespace std;

int cost[] = {6, 3, 1, 1};
long long arr[10000005];
int len = 0;

int main() {

    long long n;
    cin >> n;

    if(n % 3 != 0)
    {
        cout << 0;
        return 0;
    }

    n /= 3;
    //Get divisors
    for(long long i = 1; i * i <= n; ++i)
        if(n % i == 0)
            arr[ len++ ] = i;

    long long x, y, z = 1, ret = 0;
    long long a, b, c;
    int unique = 0;
    for(long long i = 0; i < len; ++i)
        for(long long j = i; j < len; ++j)
        {
            x = arr[i];
            y = arr[j];
            z = n / (x * y);
            if(x * y * z > n || z < y)
                break;
            if(z * x * y == n)
            {
                c = (y - x + z) / 2;
                b = (x - y + z) / 2;
                a = (x + y - z) / 2;
                if(a <= 0 || b <= 0 || c <= 0)
                    continue;
                if((a+b) * ( a+c) * (b + c) != n)
                    continue;

                if(x == y && x == z)
                    ret++;
                else if(y == z && x != y)
                    ret += 3;
                else if(y == x && y != z)
                    ret += 3;
                else if(x == z && x != y)
                    ret += 3;
                else
                    ret += 6;
            }
        }

    cout<<ret;
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
ll cal(ll a,ll b,ll c)
{
    return a==b&&b==c?1:a==b||b==c?3:6;
}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>n)
    {
        if(n%3)
        {
            printf("0\n");continue;
        }
        n/=3;
        ll ans=0;
        for(ll aaddb=2;aaddb*aaddb*aaddb<=n;aaddb++)
            if(n%aaddb==0)
                for(ll aaddc=sqrt(n/aaddb+1e-9);aaddc>=aaddb;aaddc--)
                    if(n/aaddb%aaddc==0)
                    {
                        ll baddc=n/aaddb/aaddc;
                        if(aaddb+aaddc<=baddc)break;
                        if(baddc>=aaddc&&(aaddb+aaddc+baddc)%2==0)
                        {
                            ll aaddbaadc=(aaddb+aaddc+baddc)/2;
                            ans+=cal(aaddbaadc-baddc,aaddbaadc-aaddc,aaddbaadc-aaddb);
                        }
                    }
        cout<<ans<<endl;
    }
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#define N 1000001
typedef __int64 LL;
LL a[N];
LL n,ans;
int main()
{
    LL x,y,z;
	scanf("%I64d",&n);
	LL sum=0;
    if(n%3!=0)
	{
		printf("0\n");
		return 0;
	}
	n/=3;
	for(x=2;x*x*x<=n;x++)
	{
		if(n%x==0)
		{
			LL nn=n/x;
			for(y=(LL)sqrt(1.0*nn);y>=x;y--)
			{
				if(nn%y==0)
				{
					z=nn/y;
					if((x+y+z)%2==1||z<y)
						continue;
					if(x+y<=z)
						break;
					if(x==y&&y==z)
						ans++;
					else
						if(x==y||x==z||y==z)
							ans+=3;
					else
						ans+=6;
				}
			}
		}
	}
	printf("%I64d\n",ans);

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long       LL;
typedef pair<int, int>  PII;
typedef vector<int>     VI;
typedef vector<LL>      VL;
typedef vector<string>  VS;
typedef vector<PII>     VPII;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)	 cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)	 cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define PP(x,i)	 cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)	 cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define x first
#define y second
struct _ {_() {ios_base::sync_with_stdio(0); cin.tie(0);}} _;
template<class A, class B> ostream& operator<<(ostream &o, pair<A, B> t) {o << "(" << t.x << ", " << t.y << ")"; return o;}
template<class T> T convert(const string& s) {char *p; if(is_integral<T>()) return strtoll(s.c_str(), &p, 10); else return strtod(s.c_str(), &p);}
template<class T> void PV(T a, T b, int p = 0, int w = 0, string s = " ") {int c = 0; while(a != b) {cout << setw(w) << *a++; cout << ((a != b && (!p || ++c % p)) ? s : "\n");} cout.flush();}
template<class T> inline bool chmin(T &a, T b) {return a > b ? a = b, 1 : 0;}
template<class T> inline bool chmax(T &a, T b) {return a < b ? a = b, 1 : 0;}
const LL linf = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;
const int N = 1000000;

vector<int> prime;
vector<int> minFactor;
vector<bool> isp;

void generatePrime(int n = 1000000) {
	isp.resize(n + 1, 1), isp[0] = isp[1] = 0;
	minFactor.resize(n + 1);
	for(int i = 1; i <= n; i++) minFactor[i] = i;
	for(int i = 2; i <= n; i++) {
		if(!isp[i]) continue;
		prime.push_back(i);
		for(int j = i + i; j <= n; j += i) {
			isp[j] = 0;
			if(minFactor[j] == j) minFactor[j] = i;
		}
	}
}

// when n < 1e7 and called many times, use generatePrime() to speed up.
vector< pair<LL, int> > factorize(LL n) {
	vector< pair<LL, int> > R;
	for(LL i = 2; i * i <= n; i++) {
		int c = 0;
		while(n % i == 0) n /= i, c++;
		if(c > 0) R.push_back(make_pair(i, c));
	}
	if(n > 1) R.push_back(make_pair(n, 1));
	return R;
}

vector<LL> allFactor(LL n) {
	vector< pair<LL, int> > R = factorize(n);
	vector<LL> factor;
	LL x = 1;
	vector<int> c(R.size(), 0);
	while(1) {
		factor.push_back(x);
		int carry = 1;
		for(int i = 0; i < R.size(); i++) {
			c[i] += carry, x *= R[i].x;
			if(c[i] > R[i].y) {
				carry = 1;
				while(c[i] > 0) {c[i]--; x /= R[i].x;}
			} else {
				carry = 0;
				break;
			}
		}
		if(carry > 0) break;
	}
	sort(ALL(factor));
	return factor;
}

LL res, ch;
void dfs(int pos, LL mul, LL n, LL ans, LL cur) {
	if(chmax(res, ans * (cur + 1))) ch = mul;
	if(n / mul > prime[pos]) dfs(pos, mul * prime[pos], n, ans, cur + 1);
	if(n / mul > prime[pos + 1]) dfs(pos + 1, mul * prime[pos + 1], n, ans * (cur + 1), 1);
}

LL v[100000], nv = 0;

int main() {
	generatePrime();

	LL n;
	cin >> n;

	if(n % 3) {
		cout << 0 << endl;
		return 0;
	}

	n /= 3;

	for(LL i : allFactor(n)) v[nv++] = i;

	LL res = 0;

	for(int i = 0; i < nv; i++)
		for(int j = i; j < nv; j++) {
			LL x = v[i], y = v[j];
			if(n / x % y) continue;
			LL z = n / (x * y);
			if((x + y + z) & 1) continue;
			if(x + y > z && x + z > y && y + z > x) {
				res++;
				if(i != j) res++;
			}
		}

	cout << res << endl;
	TM(0, clock());
	return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define For( i , a ) for(int i=1;i<=a;i++)
#define ort (b+s)/2
#define y2 asrwjaelkf
#define y1 asseopirwjaelkf
#define hash ____hash
#define pi M_PI

using namespace std;

inline int read() {
	int res = 0 ;int neg ;
	while(true){char ch = getchar();if(ch>='0' && ch<='9' || ch=='-'){if(ch=='-') neg = -1;else neg = 1 , res = ch-'0';break;} }
	while(true){char ch = getchar();if(ch>='0' && ch<='9') res*=10 , res+=ch-'0';else break;}
	return res*neg;
}

const int maxn = 2000020;
const int maxm = 1000020;
const int MOd = 1e9+7;
const int P = 37;

typedef long long Lint;
typedef double db;
typedef pair<Lint,Lint> ii;
typedef pair<int,ii> iii;
typedef pair<db,db> dd;
typedef pair<char,int> ci;
typedef pair<int,ci> ici;

Lint a, ans;
char ar[maxn], bs[maxn];
Lint us[20][50];
vector<ii> w;

void f( int n, Lint a, Lint b, Lint c ) {
	if( n == w.size() ) {
		int t = (a+b+c)/2;
		if( (a+b+c)%2 == 0 && a < t && b < t && c < t ) ans++;
		return;
	}
	int h = w[n].se;
	int a2 = a, b2 = b;
	for(int i=0;i<=h;i++)
		for(int j=i;j<=h;j++)
			f( n+1, a*us[n][i], b*us[n][j-i], c*us[n][h-j] );
}

int main() {

	cin >> a;

	if( a % 3 ) {
		printf("0\n");
		return 0;
	}
	a /= 3;
	Lint c = a;
	for(int i=2;i*i<=c;i++)
		if( c % i == 0 ) {
			//~ printf("asdasd %lld\n",c);
			int t = 0;
			while( c % i == 0 ) t++, c /= i;
			w.pb( ii( i, t ) );
		}
	if( c != 1 ) w.pb( ii( c, 1 ) );

	for(int i=0;i<w.size();i++) {
		//~ printf("asdasd %lld %lld\n",w[i].fi,w[i].se);
		us[i][0] = 1;
		for(int j=1;j<=w[i].se;j++)
			us[i][j] = us[i][j-1]*w[i].fi;
	}

	f( 0, 1, 1, 1 );

	cout << ans << endl;

	return 0;
}

#ifdef WIN32
	#define I "%I64d"
		#else
	#define I "%lld"
#endif
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <stdio.h>

using namespace std;

long long n, i, j, x, y, z, a, b, c, ans, k, d[1000000];

int main()	{
    #ifndef ONLINE_JUDGE
    freopen("a.in", "r", stdin);
    freopen("a.out", "w", stdout);
   	#endif
   	scanf(I, &n);
	if (n % 3) printf("0"),exit(0);
	n /= 3;
	for (i = 2; i * i <= n; i++)
		if (n % i == 0)
			d[++k] = i;

	for (x = 1; x <= k; x++)
		if (n % d[x] == 0)
		for (y = x; y <= k; y++)
			if ((n / d[x]) % d[y] == 0)	{
				z = n / d[x] / d[y];
				if (z < d[y]) continue;
				if ((d[x]+d[y]+z)%2==0 && d[x]+d[y]>z && d[x]+z>d[y] && z+d[y]>d[x])    {
                    if (d[x] == d[y] && d[y] == z) ans++;
                        else
                    if (d[x] == d[y] || d[y] == z || d[x] == z) ans += 3;
                        else ans += 6;
				}
			}
	printf(I, ans);

    return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

long long n;
int ans, cnt, nums[50005];;

int main()
{
  while (cin >> n) {
		if (n % 3) {
			cout << 0 << endl;
			continue;
		}
		n /= 3;
		ans = cnt = 0;
		for (int i = 1; i <= 50000; ++i)
			if ((4 * n) % i == 0)
				nums[cnt++] = i;
		for (int a = 1; 8LL * a * a * a <= n; ++a) {
			for (int i = 0; i < cnt; ++i) {
				int b = nums[i] - a;
				if (b < a)
					continue;
				if (2LL * b * (a + b) * (a + b) > n)
					continue;
				long long t = 1LL * (a + b) * (a + b) * (a - b) * (a - b) + 4LL * n * (a + b);
				long long k = (long long)sqrt(1.0 * t);
				if (k * k == t) {
					long long c = 0LL - a - b + k / (a + b);
					if ((c & 1) || (c < 2 * b))
							continue;
					c >>= 1;
					if (a == b && b == c) {
						ans++;
					} else if ((a == b) || (b == c)) {
						ans += 3;
					} else {
						ans += 6;
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <set>
#define MAXN 10010
#define INF 1000000007
#define MP(x,y) make_pair(x,y)
#define FI first
#define SE second
#define EPS 1e-8
using namespace std;
int yi[MAXN];
int main()
{
    //freopen("/home/moor/Code/input","r",stdin);
    long long n,tt,tmp,a,b,c;
    while(cin>>n)
    {
        int ans=0;
        if(n%3==0)
        {
            n/=3;
            int cnt=0;
            for(long long i=2;i*i<=n;++i)
                if(n%i==0)
                   yi[cnt++]=i;
            for(int i=0;i<cnt;++i)
                for(int j=i;j<cnt;++j)
                {
                    tt=(long long )(yi[i]*yi[j]);
                    if(n%tt==0&&n/tt>=yi[j])
                    {
                        tt=n/tt;
                        tmp=yi[i]+yi[j]+tt;
                        if(tmp&1)   continue;
                        if(yi[i]+yi[j]<=tt)  continue;
                        tmp/=2;
                        a=tmp-tt,b=tmp-yi[j],c=tmp-yi[i];
                        if(a<=0||b<=0||c<=0||a>b||a>c||b>c) continue;
                        if(a==c)    ++ans;
                        else    ans+=(a==b||b==c)?3:6;
                    }
                }
        }
        printf("%d\n",ans);
    }
    return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>

using namespace std;

long long d[1000000];

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	long long n;
    scanf("%I64d", &n);

    if (n % 3 != 0) {
        printf("0\n");
        return 0;
    } else {
        n /= 3;
    }

    int tot = 0;
    for (int i = 1; (long long)i * i <= n; i ++)
        if (n % i == 0) {
            d[tot ++] = i;
            if ((long long)i * i != n) d[tot ++] = n / i;
        }
    sort(d, d + tot);

    int a = 1;
    long long ans = 0;
    while (true) {
        if (8LL * a * a * a > n) break;
        int i = 0;
        while (i < tot && d[i] < a * 2)
            i ++;
        while (i < tot) {
            long long b = d[i] - a;
            if (4LL * a * b * b + 2LL * a * a * b + 2LL * b * b * b > n) break;
            long long a1 = a + b;
            long long b1 = 2LL * a * b + (long long)a * a + (long long)b * b;
            long long c1 = (long long)a * a * b + (long long)b * b * a - n;
            long long delta = b1 * b1 - 4 * a1 * c1;
            if (delta >= 0) {
                long long tt = sqrt((long double)delta + 1e-5);
                if (tt * tt == delta && tt >= b1 && (tt - b1) % (2 * a1) == 0) {
                    long long c = (tt - b1) / (2 * a1);
                    if (c >= b) {
                        if (a == b && b == c) {
                            ans += 1;
                        }
                        if (a == b && b < c) {
                            ans += 3;
                        }
                        if (a < b && b == c) {
                            ans += 3;
                        }
                        if (a < b && b < c) {
                            ans += 6;
                        }
                    }
                }
            }
            i ++;
        }
        a ++;
    }

    printf("%I64d\n", ans);

	return 0;
}

#include<cstdio>

#define long long long

long n;
long a[10000005];
int nn;
long ans;

int main(){
  scanf("%I64d", &n);
  if(n % 3){
    printf("0\n");
    return 0;
  }
  n /= 3;
  for(long x = 2; x * x <= n; x++){
    if(n % x == 0){
      a[nn++] = x;
    }
  }
  for(int i = 0; i < nn; i++){
    long tmp = n / a[i];
    for(int j = i; j < nn; j++){
      long z = tmp / a[j];
      if(z * a[j] != tmp) continue;
      if(z < a[j]) continue;
      if(a[i] + a[j] <= z) continue;
      if(a[i] + a[j] + z & 1) continue;
      if(a[i] == a[j]){
	if(a[j] == z) ans++;
	else ans += 3;
      }
      else{
	if(a[j] == z) ans += 3;
	else ans += 6;
      }
    }
  }
  printf("%I64d\n", ans);
}

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;

long long d[1000000],ans=0,x,y,z,a,b,c,tmp,n,sum;
int tot=0;

int main()
{
	cin>>n;
	if (!(n%3))
	{
		n/=3;
		for (x=1; x*x<=n; x++)
			if (!(n%x)) d[++tot]=x;
		for (int i=1; i<=tot; i++)
		{
			x=d[i]; if (x*x*x>n) break; tmp=n/x;
			for (int j=i; j<=tot; j++)
			{
				if (tmp%d[j]) continue;
				y=d[j]; z=tmp/y; sum=x+y+z;
				if (sum%2) continue;
				if (z<y) break;
				if (x+y<=z) continue;
				a=sum-z; b=sum-y; c=sum-x;
				if (a==c) ans+=1; else
				if (a==b || b==c) ans+=3; else ans+=6;
			}
		}
	} cout<<ans; return 0;
}

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#define REP(i,m) for(int i=0;i<m;++i)
#define REPN(i,m,in) for(int i=in;i<m;++i)
#define ALL(t) (t).begin(),(t).end()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
using namespace std;
static const int INF =500000000;
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
typedef long long int lint;
typedef pair<int,int> pi;
lint n;
pair<lint,int> factor[100];
lint tot[100];
int m=0;
lint ans;
bool f(lint a){
	if(a<=0 || a&1) return true;
	return false;
}

void check(lint a,lint b,lint c){
	if(f(b+c-a) || f(c+a-b) || f(a+b-c));
	else ++ans;
}

void dfs(int d,lint a,lint b,lint c){
	if(d==m){
		check(a,b,c);
		return;
	}
	lint mul1=1;
	REP(i,factor[d].sc+1){
		lint mul2=1;
		REP(j,factor[d].sc+1-i){
			lint mul3=tot[d]/mul1/mul2;
			dfs(d+1,a*mul1,b*mul2,c*mul3);
			mul2*=factor[d].fr;
		}
		mul1*=factor[d].fr;
	}
}
int main(){
	cin>>n;

	if(n%3){
		puts("0");
		return 0;
	}
	n/=3;

	lint t=n;

	for(lint i=2;i*i<=t;++i) if(t%i==0){
		factor[m].fr=i;
		lint tmp=1;
		while(t%i==0){
			t/=i;
			tmp*=i;
			factor[m].sc++;
		}
		tot[m]=tmp;
		++m;
	}
	if(t>1) factor[m++]=mp(t,1),tot[m-1]=t;;

	dfs(0,1,1,1);

	cout<<ans<<endl;

	return 0;
}

#include<stdio.h>
#include<vector>
#include<iostream>
using namespace std;

int main()
{
	vector<long long> v;
	long long n,x,y,z,N,ans=0;
	cin >> n;
	if( n%3 == 0 ){
		n /= 3;
		for( long long i = 1; i*i <= n; i++ )
        {

			if( n%i == 0 )
                v.push_back(i);

        }
		for( int i = 0; i < v.size(); i++ ){
			x = v[i];
			if( x*x*x > n )
                break;
			N = n/x;
			for( int j = i; j < v.size(); j++ ){
				y = v[j];
				if( y*y > N )
				break;
				if( N%y == 0 ){
					z = N/y;
					if( (x+y+z)%2 == 0 && x+y>z ){
						if( x == y && y == z )
						ans+=1;
						else if( x != y && y != z )
						ans+=6;
						else
						ans+=3;
					}
				}
			}
		}
		cout << ans << endl;
	}else{
		cout << "0\n";
	}
	return 0;
}

#include<cstdlib>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<list>
#include<queue>
#include<vector>
#define ULL unsigned long long
#define LL long long
#define UI unsigned int
#define inf 0x7fffffff
#define eps 1e-8
#define N 10000009
#define M 60009
using namespace std;
LL T,n,m,k,t;
LL s[N];
int main()
{
#ifndef ONLINE_JUDGE
    freopen("ex.in","r",stdin);
#endif
    int ncase=0;
    while (scanf("%I64d",&n)==1)
    {
        if(n%3)
        {
            printf("0\n");continue;
        }
        n/=3;
        int cnt=0;
        for(LL i=2;i*i<=n;i++)
        if(n%i==0)
        {
            s[cnt++]=i;
//            cout<<i<<" ";
        }
//        cout<<endl;
        LL ans=0;
        for (int i=0;i<cnt;++i )
        for(int j=i;j<cnt;j++)
        {
            LL a=s[i],b=s[j];
            LL c=n/(a*b);
            if(a*b*c!=n)continue;
            if(a+b<c+2)continue;//
            if((a+b-c)%2)continue;
//            if((a+c-b)%2)continue;
//            if((c+b-a)%2)continue;
//            if((a+b+c)%2)continue;
            if(c<b)break;
            if(a==b&&a==c)ans++;
            else if(a==b||b==c)ans+=3;
            else ans+=6;
        }
        cout<<ans<<endl;
    }
    return 0;
}

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <climits>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <list>
#include <bitset>
#include <cassert>
#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define For(i, st, en) for(int i=(st); i<=(int)(en); i++)
#define Ford(i, st, en) for(int i=(st); i>=(int)(en); i--)
#define forn(i, n) for(int i=0; i<(int)(n); i++)
#define ford(i, n) for(int i=(n)-1; i>=0; i--)
#define fori(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define in(x) int (x); input((x));
#define x first
#define y second
#define less(a,b) ((a) < (b) - EPS)
#define more(a,b) ((a) > (b) + EPS)
#define eq(a,b) (fabs((a) - (b)) < EPS)
#define remax(a, b) ((a) = (b) > (a) ? (b) : (a))
#define remin(a, b) ((a) = (b) < (a) ? (b) : (a))
int clock0 = clock();
using namespace std; typedef long double ld; template <class _T> inline _T sqr(const _T& x) {return x * x;} template <class _T> inline string tostr(const _T& a) {ostringstream os(""); os << a; return os.str();} const ld PI = 3.1415926535897932384626433832795L; const ld EPS = 4e-5; char TEMPORARY_CHAR; typedef long long ll; typedef unsigned long long ull; typedef set < int > SI; typedef vector < int > VI; typedef vector < vector < int > > VVI; typedef map < string, int > MSI; typedef pair < int, int > PII; const int INF = 2e9; typedef complex<ld> cbase; inline void fft (vector<cbase> &a, bool invert) {int n = (int)a.size(); for (int i = 1, j = 0; i < n; ++i) {int bit = n >> 1; for (; j >= bit; bit >>= 1) j -= bit; j += bit; if (i < j) swap(a[i], a[j]);} for (int len = 2; len <= n; len <<= 1) {ld ang = 2 * PI / len * (invert ? -1 : 1); cbase wlen(cos(ang), sin(ang)); for (int i = 0; i < n; i += len) {cbase w(1); for (int j=0; j < len / 2; ++j) {cbase u = a[i + j], v = a[i + j + len / 2] * w; a[i + j] = u + v; a[i + j + len / 2] = u - v; w *= wlen;}}} if (invert) for (int i = 0; i < n; ++i) a[i] /= n;} inline void input(int &a) {a = 0; while (((TEMPORARY_CHAR = getchar()) > '9' || TEMPORARY_CHAR < '0') && (TEMPORARY_CHAR != '-')){} char neg = 0; if (TEMPORARY_CHAR == '-') {neg = 1; TEMPORARY_CHAR = getchar();} while (TEMPORARY_CHAR <= '9' && TEMPORARY_CHAR >= '0') {a = (a << 3) + (a << 1) + TEMPORARY_CHAR - '0'; TEMPORARY_CHAR = getchar();} if (neg) a = -a;} inline void out(int a) {if (!a) putchar('0'); if (a < 0) {putchar('-'); a = -a;} char s[10]; int i; for(i = 0; a; ++i) {s[i] = '0' + a % 10; a /= 10;} ford(j, i) putchar(s[j]);} inline int nxt() {in(ret); return ret;} struct lnum {vector <int> a; int base; lnum(int num = 0, int base = 1000000000):base(base) {if (!num) a.resize(1); while(num) {a.pb(num % base); num /= base;}} inline int len() const {return a.size();} lnum & operator=(const lnum &l) {if (this != &l) {a = l.a; base = l.base;} return *this;} inline friend lnum operator+(const lnum &l, const lnum &r) {lnum ret(0, l.base); int base = l.base; int ln = l.len(), rn = r.len(); int n = max(ln, rn); ret.a.resize(n); int o = 0; for(int i = 0; i < n; ++i) {int s = o; if (i < ln) s += l.a[i]; if (i < rn) s += r.a[i]; o = s >= base; if (o) s -= base; ret.a[i] = s;} if (o) ret.a.push_back(1); return ret;} inline friend lnum operator-(const lnum &l, const lnum &r) {lnum ret(0, l.base); int base = l.base; int n = l.len(); int rn = r.len(); ret.a.resize(n); int o = 0; for(int i = 0; i < n; ++i) {int s = l.a[i] - o; if (i < rn) s -= r.a[i]; o = s < 0; if (o) s += base; ret.a[i] = s;} if (ret.len() > 1 && !ret.a.back()) ret.a.pop_back(); return ret;} inline friend lnum operator*(const lnum &l, const lnum &r) {lnum ret(0, l.base); int base = l.base; if (l.len() * r.len() > 1000000) {vector<cbase> fa (l.a.begin(), l.a.end()), fb (r.a.begin(), r.a.end()); int n = 1; while (n < max (l.len(), r.len())) n <<= 1; n <<= 1; fa.resize (n), fb.resize (n); fft (fa, false), fft (fb, false); for (int i = 0; i < n; ++i) fa[i] *= fb[i]; fft (fa, true); ret.a.resize(n); for (int i = 0; i < n; ++i) ret.a[i] = int (fa[i].real() + 0.5); int carry = 0; for (int i=0; i < n; ++i) {ret.a[i] += carry; carry = ret.a[i] / base; ret.a[i] %= base;}} else {ret.a.resize(l.len() + r.len()); for (int i = 0; i < l.len(); ++i) for (int j = 0, carry = 0; j < r.len() || carry; ++j) {long long cur = ret.a[i + j] + (ll)l.a[i] * (j < r.len() ? r.a[j] : 0) + carry; ret.a[i + j] = cur % base; carry = cur / base;}} while (ret.len() > 1 && !ret.a.back()) ret.a.pop_back(); return ret;} inline friend lnum operator/(const lnum &l, const int &r) {lnum ret(0, l.base); ret.a.resize(l.len()); int carry = 0; for(int i = l.len() - 1; i >= 0; --i) {long long cur = l.a[i] + (ll)carry * l.base; ret.a[i] = cur / r; carry = cur % r;} while (ret.len() > 1 && ret.a.back() == 0) ret.a.pop_back(); return ret;}  inline friend bool operator<(const lnum &l, const lnum &r) {if (l.len() < r.len()) return true; if (l.len() > r.len()) return false; int n = l.len(); for(int i = n - 1; i >= 0; --i) {if (l.a[i] < r.a[i]) return true; if (l.a[i] > r.a[i]) return false;} return false;} inline friend bool operator>(const lnum &l, const lnum &r) {return r < l;} inline friend bool operator==(const lnum &l, const lnum &r) {if (l.len() != r.len()) return false; int n = l.len(); for(int i = n - 1; i; --i) {if (l.a[i] != r.a[i]) return false;} return true;} inline friend bool operator!=(const lnum &l, const lnum &r) {return !(l == r);} inline void print() {if (base == 1000000000) {printf("%d", a.back()); for(int i = a.size() - 2; i >=0; --i) printf("%09d", a[i]);} else {for(int i = a.size() - 1; i >= 0; --i) printf("%d", a[i]);}}};

int main()
{
    ll n;
    cin >> n;
    if (n % 6 != 0)
    {
        puts("0");
        return 0;
    }
    n /= 3;
    ll ans = 0;
    vector <ll> div;
    for(ll i = 2; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            div.pb(i);
            if (i != n / i) div.pb(n / i);
        }
    }
    sort(all(div));
    int sq3 = exp(log(n + 1) / 3);
    forn(i, div.size())
    {
        ll x = div[i];
        if (x > sq3) break;
        ll m = n / x;
        ll sq2 = sqrt(m + 1);
        For(j, i, (int)div.size() - 1)
        {
            ll y = div[j];
            if (y > sq2) break;
            if (m % y == 0)
            {
                ll z = m / y;
                //cout << x << " " << y << " " << z << endl;
                if ((x + y + z) & 1ll) continue;
                if (z >= x + y) continue;
                if (x == z)
                    ans += 1;
                else
                {
                    if (y == z || x == y)
                        ans += 3;
                    else
                        ans += 6;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>

const int MAXN = 1e7+10;

using namespace std;

long long N;
long long factor[MAXN];
int si;

int main()
{
	cin >> N;
	long long A = N/3;
	if(A*3 != N)
	{
		printf("0\n");
		return 0;
	}
	for(long long c = 2 ; c*c <= A ; c++)
	{
		long long a = A/c;
		if(a*c == A)
			factor[si++] = c;
	}
	// printf("%d\n", si);
	long long sol = 0;
	for(int c = 0 ; c < si ; c++)
	{
		long long a = factor[c];
		long long b = A/a;
		for(int d = c ; d < si ; d++)
		{
			long long x = b/factor[d];
			if(a <= factor[d] and factor[d] <= x and x*factor[d] == b and ((a+factor[d]+x)&1) == 0)
			{
				// a,factor[d],x
				if(a+factor[d] > x)
				{
					if(a == factor[d] and factor[d] == x)
						sol++;
					else if(a == factor[d] or factor[d] == x or a == x)
						sol += 3;
					else
						sol += 6;
				}
			}
		}
	}
	cout << sol << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 10000020

ll tag[maxn/64 + 1], pr[maxn], len, per[15], pw[15][48];
vector<ll> fac, num;
vector<vector<pair<ll, ll> > > v;
bool next()
{
    for(int i = 0; i < len; i++)
        if(per[i] < v[i].size() - 1)
        {
            for(int k = i - 1; k >= 0; k--)
                per[k] = 0;
            per[i]++;
            return true;
        }
    return false;
}

int main()
{
    ll n, i, k, cnt, h, a, b, c, ret = 0;
    for(i = 3; i < maxn; i += 2)
        if(!(tag[i/64]&(1LL<<(i%64))))
            for(k = i*i; k < maxn; k += 2*i)
                tag[k/64] |= 1LL<<(k%64);
    pr[0] = 2;
    k = 1;
    for(i = 3; i < maxn; i += 2)
        if(!(tag[i/64]&(1LL<<(i%64)))) pr[k++] = i;
    scanf("%I64d", &n);
    if(n % 3 != 0) puts("0");
    else
    {
        n /= 3;
        h = n;
        k = sqrt(n);
        for(i = 0; pr[i] <= k; i++)
            if(n % pr[i] == 0)
            {
                cnt = 0;
                while(n % pr[i] == 0)
                {
                    n /= pr[i];
                    cnt++;
                }
                k = sqrt(n);
                fac.push_back(pr[i]);
                num.push_back(cnt);
            }
        if(n > 1)
        {
            fac.push_back(n);
            num.push_back(1);
        }
        len = fac.size();
        for(i = 0; i < len; i++)
        {
            pw[i][0] = 1;
            for(k = 1; k <= num[i]; k++)
                pw[i][k] = fac[i]*pw[i][k - 1];
        }
        for(i = 0; i < len; i++)
        {
            vector<pair<ll, ll> > vt;
            for(a = 0; a <= num[i]; a++)
            for(b = 0; b <= num[i] - a; b++)
                vt.push_back(make_pair(a, b));
            v.push_back(vt);
        }
        do
        {
            a = b = 1;
            for(i = 0; i < len; i++)
            {
                a *= pw[i][v[i][per[i]].first];
                b *= pw[i][v[i][per[i]].second];
            }
            c = h/a/b;
            if(!((a + b + c)&1) && (a + b - c)/2 > 0 && (a - b + c)/2 > 0 && (b + c - a)/2 > 0)
                ret++;
        }while(next());
        printf("%I64d", ret);
    }
    return 0;
}

#include<bits/stdc++.h>
#define LL long long

using namespace std;

LL n;
LL d[612345];

LL fd1() {
    if(n % 24 == 0) {
        LL m = n / 24;
        LL p = 1;
        while(p * p * p <= m) {
            if(p * p * p == m) return 1;
            ++p;
        }
    }
    return 0;
}

LL fd2() {
    LL ret = 0;
    if(n % 6 != 0) return 0;
    LL m = n / 6;
    LL lim2 = sqrt(m), lim3 = 1;
    while(lim3*lim3*lim3 <= m) lim3++; lim3--;
    for(LL i = max((LL)1, lim3 - 10); i <= lim2; ++i) {
        if(m % (i * i) == 0 && m / i / i < i && m / i / i * 2 != i)
            ret++;
    }
    return ret * 3;
}

LL fd3() {
    LL ret = 0;
    if(n % 3 != 0) return 0;
    LL m = n / 3;
    int p = 0;
    LL q = sqrt(m);
    LL lim3 = 1;
    while(lim3*lim3*lim3 <= m) lim3++; lim3--;
    for(LL i = 2; i <= q; ++i) {
        if(m % i == 0) {
            d[++p] = i;
            if(i < m / i)
                d[++p] = m / i;
        }
    }
    sort(d + 1, d + p + 1);
    for(int i = 1; i <= p; ++i) {
        if(d[i] > lim3 + 10) break;
        for(int j = i + 1; j <= p; ++j) {
            if(m / d[i] % d[j] == 0 && m / d[i] / d[j] > d[j]) {
                LL a = d[i] + d[j] - m / d[i] / d[j];
                LL b = d[i] + m / d[i] / d[j] - d[j];
                LL c = d[j] + m / d[i] / d[j] - d[i];
                if(a > 0 && b > 0 && c > 0 && a % 2 == 0 && b % 2 == 0 && c % 2 == 0)
                    ret++;
            }
            else if(m / d[i] / d[j] < d[j]) break;
        }
    }
    return ret * 6;
}

void op_ar(LL *ar, int num) {
    for(int i = 1; i <= num; ++i) {
        printf("%lld", ar[i]);
        if(i == num) printf("\n");
        else printf(" ");
    }
}

int main() {
    scanf("%lld", &n);
    LL ans = 0;
    ans += fd1();
    //printf("%lld\n", ans);
    ans += fd2();
    //printf("%lld\n", ans);
    ans += fd3();
    printf("%lld\n", ans);
    return 0;
}

#include"iostream"
#include"cstdio"
#include"cmath"
using namespace std;
__int64 n;
__int64 fac[1000000], cnt;

int main()
{
    __int64 ans, i, j, t, a, b, c;
    while(~scanf("%I64d",&n))
    {
        ans=0;
        if(n%3==0)
        {
            n/=3, cnt=0;
            for(i=1; i*i<=n; i++) if(n%i==0) fac[cnt++]=i;
            for(i=0; i<cnt; i++)
            {
                a=fac[i], t=n/fac[i];
                for(j=0; j<cnt && fac[j]*fac[j]<=t ; j++)
                {
                    if(t%fac[j]) continue;
                    b=fac[j], c=t/fac[j];
                    if(a+b>c && b+c>a && a+c>b && (!((a+b+c)&1))) ans+=(b*b==t ? 1 : 2);
                }
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define SIZE(v) ((int)(v).size())

#define BEGIN(v) ((v).begin())
#define END(v) ((v).end())
#define ALL(v) BEGIN(v),END(v)
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) SORT(v);(v).erase(unique(ALL(v)),END(v))

#define FOR(i,l,r) for(int i=(l);i<(r);i++)
#define FOREACH(i,v) for(typeof((v).begin()) i=(v).begin();i!=(v).end();i++)

vector <bool> tagPrime;
vector <int> prime;

void initPrime(int n) {
	tagPrime = vector <bool> (n + 1);
	tagPrime[0] = tagPrime[1] = true;
	prime.clear();
	for (int i = 2; i <= n; i++) {
		if (tagPrime[i]) continue;
		prime.push_back(i);
		if (i > n / i) continue;
		for (int j = i * i; j <= n; j += i) {
			tagPrime[j] = true;
		}
	}
}

long long n, res;
vector<long long> primeFactor;
vector<int> cnt;

void dfs(int depth, long long x, long long y) {
	if (depth == SIZE(cnt)) {
		long long z = n / x / y;
		res += x + y > z && x + z > y && y + z > x;
		return ;
	}
	vector<long long> pow(cnt[depth] + 1);
	pow[0] = 1;
	FOR(i, 0, cnt[depth]) pow[i + 1] = pow[i] * primeFactor[depth];
	if (primeFactor[depth] == 2) {
		dfs(depth + 1, x * pow[cnt[depth]], y);
		dfs(depth + 1, x, y * pow[cnt[depth]]);
		dfs(depth + 1, x, y);
		if (cnt[depth] < 3) return ;
		x <<= 1;
		y <<= 1;
		cnt[depth] -= 3;
	}
	FOR(i, 0, cnt[depth] + 1) {
		FOR(j, 0, cnt[depth] - i + 1) {
			dfs(depth + 1, x * pow[i], y * pow[j]);
		}
	}
}

int main() {
	initPrime(10000000);
	cin >> n;
	if (n % 3) {
		cout << 0 << endl;
	} else {
		n /= 3;
		long long tmp = n;
		FOREACH(it, prime) {
			if (*it > tmp / *it) break;
			if (tmp % *it) continue;
			primeFactor.push_back(*it);
			cnt.push_back(1);
			for (tmp /= *it; !(tmp % *it); tmp /= *it, cnt.back()++) ;
		}
		if (tmp > 1) {
			primeFactor.push_back(tmp);
			cnt.push_back(1);
		}
		if (primeFactor.front() == 2) {
			dfs(0, 1, 1);
		}
		cout << res << endl;
	}
	return 0;
}

#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <iterator>
#include <memory>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define mset(a) memset(a,0,sizeof(a))
#define mmset(a) memset(a,-1,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))

const int inf=1000000007;
const ll linf=1000000000000000000LL;
const double eps=0.000001;
const double pi=3.14159265358979323846;

template <class T> T abs(T k){return k>=0?k:-k;}
template <class T> T sqr(T n){return n*n;}
template <class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template <class T> T mod(T a,T b){return (a%b+b)%b;}
template <class T> void mode(T &a,T b){a=mod(a,b);}
template <class T> void maxe(T &a,T b){a=max(a,b);}
template <class T> void mine(T &a,T b){a=min(a,b);}

void fileio_in_out()
{
     freopen(".in","r",stdin);
     freopen(".out","w",stdout);
}

void fileio_txt()
{
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
}

//==================================================

#define N 2222222

int test;
//int n,m,k,ans;
ll n;

int getans()
{
    int ret=0;

    if(n%3)
      return 0;
    n/=3;
    for(ll i=2;i*i*i<=n;i++)
    {
      if(n%i)
        continue;
      for(ll j=(ll)sqrt(n/i);j>=i;j--)
      {
        ll k=(n/i)/j;
        if(i+j<=k)
          break;
        if((n/i)%j)
          continue;
        if((i+j+k)&1)
          continue;
        ret+=(i==j&&j==k)?1:((i==j||j==k||i==k)?3:6);
      }
    }

    return ret;
}

int main()
{
    //fileio_in_out();
    //fileio_txt();

    scanf("%I64d",&n);
    printf("%d\n",getans());

    //system("pause");
    return 0;
}

#include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>

#define pb push_back
#define sz 20000000

typedef long long ll;

using namespace std;

ll n, x, y, d, z;
int res, t;
vector<int> a;

int main()
{
	scanf("%I64d", &n);
	if (n%3==0)
	{
		n/=3;
		t=(int)sqrt(n)+1;
		for (int i=2; i<=t; i++)
			if (n%i==0)
				a.pb(i);
		for (int i=0; i<a.size(); i++)
		{
		 	x=a[i];
		 	d=n/a[i];
		 	for (int j=a.size()-1; j>=0; j--)
		 		if (d%a[j]==0)
		 		{
		 		 	y=d/a[j];
		 		 	z=a[j];
		 		 	if (y>=x+z) break;
		 		 	if (x+y>z&&y+z>x&&(x+y+z)%2==0)
		 		 		res++;
		 		}
		}
	}
	cout<<res;
}

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;

LL n,ans;

LL Max(LL a1,LL a2)
{
    return a1>a2?a1:a2;
}

int main()
{
    while (~scanf("%I64d",&n))
    {
        if (n%3)
        {
            printf("0\n");
            continue;
        }
        n/=3;
        ans=0;
        for (LL i=2;i*i*i<=n;i++)
        {
            if (n%i) continue;
            LL ni=n/i;
            LL u2=(LL)sqrt((long double)ni*4+i*i);
            u2=Max(i,(u2-i)/2);
            for (LL j=u2;j*j<=ni;j++)
            {
                if (ni%j) continue;
                LL k=ni/j;
                if (k<j) continue;
                if ((i+j+k)%2) continue;
                if ((i+j)<=k) continue;
                if (i==k) ans++;
                else if (i==j||j==k) ans+=3;
                else ans+=6;
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define FOR(i,s,e) for (int i=(s); i<(e); i++)
#define FOE(i,s,e) for (int i=(s); i<=(e); i++)
#define FOD(i,s,e) for (int i=(s)-1; i>=(e); i--)
#define CLR(a,x) memset(a, x, sizeof(a))
#define EXP(i,l) for (int i=(l); i; i=qn[i])
#define LLD long long
using namespace std;

int m;
LLD n;
LLD a, b, c, x[2];
LLD f[10000];

int Solve(LLD a, LLD b, LLD c, LLD x[]){
	LLD D = b*b - 4*a*c, d;
	if (D < 0) return 0;
	if (D == 0){
		x[0] = -b / 2 / a;
		if (x[0] <= 0 || x[0] * -2 * a != b) return 0;
		return 1;
	}
	else{
		d = (LLD)sqrt(D*1.);
		while (d*d < D) ++d;
		while (d*d > D) --d;
		if (d*d == D){
			int m = 0;
			for (int j=-1; j<=1; j+=2){
				x[m] = (-b + j*d) / 2 / a;
				if (x[m] > 0 && x[m] * 2 * a == -b + j*d) ++m;
			}
			return m;
		}
		return 0;
	}
}

int ret = 0;

int main(){
	scanf("%I64d", &n);
	if (n % 3 != 0) ret = 0;
	else{
		n /= 3;
		for (LLD i=1; i<=40000; i++) if (n % i == 0) f[m++] = i;
		for (LLD i=1; i<=17000; i++){
			FOE(jj,0,m){
				LLD j = f[jj] - i;
				if (j < i) continue;
				a = i + j;
				b = 2*i*j + i*i + j*j;
				c = i*i*j + i*j*j - n;
				if (c > 0) break;
				int t = Solve(a, b, c, x);
				if (t && x[0] >= j){
					if (i == j && j == x[0]) ++ret;
					else if (i != j && j != x[0]) ret += 6;
					else ret += 3;
				}
				if (t == 2 && x[1] >= j){
					if (i == j && j == x[1]) ++ret;
					else if (i != j && j != x[1]) ret += 6;
					else ret += 3;
				}
			}
		}
	}
	printf("%d\n", ret);
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
const ll size=1e7+10;
ll n,ans,top,q[size];
ll read(){
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}
int main(){
	n=read();
	if(n%3==0){
		n/=3;
		for(ll i=1;i<=sqrt(n);i++){
			if(n%i==0){
				q[++top]=i;
			}
		}
		for(ll i=1;i<=top;i++){
			for(ll j=i;j<=top;j++){
				ll x=q[i],y=q[j],z=n/x/y;
				if(n%(x*y)==0&&(x+y+z)%2==0&&x+y>z&&x+z>y&&y+z>x){
					ans+=(i!=j)?2:1;
				}
			}
		}
		printf("%lld\n",ans);
	}
	else printf("0");
	return 0;
}

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree <pair <int, int>, null_type, less <pair <int, int> >, rb_tree_tag, tree_order_statistics_node_update>
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define size(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define endl "\n"
//#define int long long

using namespace std;

void dout() {
    cerr << endl;
}
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int K = 50000;
ll n;
vector <int> v;

int num(int a, int b, int c) {
    if (a == b && b == c) {
        return 1;
    }
    if (a == b || b == c) {
        return 3;
    }
    return 6;
}

void solve(int tc) {
    // check for (int i = 0; i < n; j++)
    cin >> n;
    if (n % 3) {
        cout << 0;
        return;
    }
    n /= 3;
    for (int i = 1; i <= K; i++) {
        if (n % i == 0) {
            v.pb(i);
        }
    }
    ll ans = 0;
    for (int a = 1; a <= K / 2; a++) {
        for (auto b : v) {
            b -= a;
            if (b < a) {
                continue;
            }
            ll A = (a + b);
            if (A * A * A > n) {
                continue;
            }
            ll B = A * A;
            ll C = (ll)a * b * A - n;

            ll D = B * B - 4 * A * C;
            ll d = sqrtl(D);
            while (d * d < D) {
                d++;
            }
            while (d * d > D) {
                d--;
            }
            if (d * d == D) {
                ll c = (-B + d) / (2 * A);
                if (c >= b) {
                    ans += num(a, b, c);
                }
            }
        }
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int tc = 1;
//    cin >> tc;
    for (int i = 0; i < tc; i++) {
        solve(i);
//        cleanup();
    }
}

#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iterator>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sstream>

using namespace std;

#define REP(i,n) for (int i=0,_n=(n); i < _n; i++)
#define REPD(i,n) for (int i=(n)-1; i >= 0; i--)
#define FOR(i,a,b) for (int _b=(b), i=(a); i <= _b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;i--)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))

#define CLEAR(x) memset(x,0,sizeof x);
#define CLEARA(x) memset(&x,0,sizeof x);
#define FILL(x,v) memset(x,v,sizeof x);
#define FILLA(x,v) memset(&x,v,sizeof x);

#define VAR(a,b) __typeof(b) a=(b)
#define FOREACH(it,c) for(VAR(it,(c).begin());it!=(c).end();++it)

#define REVERSE(c) reverse(ALL(c))
#define UNIQUE(c) SORT(c),(c).resize(unique(ALL(c))-(c).begin())
#define INF 0x7fffffff
#define X first
#define Y second
#define pb push_back
#define SZ(c) (int)(c).size()
#define MP make_pair
#define eps 1.0e-11
const double pi = acos(-1.0);

typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;

LL n;

inline LL calc(LL a, LL b, LL c)
{
	return (a+b)*(b+c)*(a+c);
}

inline LL calc2(LL a, LL b, LL c)
{
	return a*a*(b+c) + b*b*(a+c) + c*c*(a+b) + 2*a*b*c;
}

inline bool getc(LL x, LL& res)
{
	res = sqrt((double)x);
	LL val;
	while ((val=res*res) < x)
		++res;
	if (val > x && res > 0)
	{
		--res;
		while (res > 0 && (val=res*res) > x)
			--res;
	}
	return val == x;
}

int main()
{
	//freopen("data.in","r",stdin);
	cin >> n;

	/*int ln = 10;
	REP(i,ln) REP(j,ln) REP(k,ln)
		if (calc(i,j,k)==n)
			printf("%d %d %d\n",i,j,k);*/

	if (n%3 != 0)
	{
		printf("0\n");
		return 0;
	}
	n/=3;

	LL res = 0;
	LL mxb = 1;
	LL k = 0;
	for (LL ab = 2; ab*ab*ab <= n; ab++)
	{
		//if (ab%1000 == 0) printf("= %d\n",(int)ab);
		//while (calc(a,a,c) > n) --c,++k;
		if (n%ab != 0) continue;
		LL nn = n/ab;
		LL mn;
		LL A = 1;
		LL B = ab;
		LL C = -nn;
		LL det = B*B-4*A*C;
		getc(det,mn);
		mn -= B;
		mn /= 2*A;
		for (LL ac = max(mn,ab); true; ++ac)
		{
			LL bc = nn / ac;
			if (bc < ac) break;
			if (bc+2 > ab+ac)
			{
				++k;
				continue;
			}
			if (nn%(ac) != 0) continue;
			LL sum = ab+bc+ac;
			if (sum%2 != 0) continue;
			sum/=2;
			LL a = sum-bc;
			LL b = sum-ac;
			LL c = sum-ab;
			if (a>b || b>c)
			{
				printf("BAD\n");
				continue;
			}
			if (a==b&&a==c)
				++res;
			else if (a==b || a==c || b==c)
				res+=3;
			else
				res+=6;
			/*LL A = a+b;
			LL B = (a+b)*(a+b);
			LL C = a*b*(a+b)-n;
			if (A*b*b + B*b + C > 0) break;
			LL det = B*B-4*A*C;
			LL root;
			++k;
			if (getc(det,root))
			{
				LL c = -B+root;
				if (c > 0 && (c%(2*A)) == 0)
				{
					c /= 2*A;
					if (a==b&&a==c)
						++res;
					else if (a==b || a==c || b==c)
						res+=3;
					else
						res+=6;
				}
			}*/
		}
	}
	cout << res << endl;
	//cout << k << endl;
	return 0;
}

#include<iostream>
#include <algorithm>
#include <cmath>
#include <fstream>
using namespace std;

int main() {
 // freopen("input.txt","r",stdin);
 // freopen("output.txt","w",stdout);

 long long d,i,j,a,b,c,t=0,nn;
 long long n;
 cin>>n;
 if (n%3) {cout<<0;return(0);}
 n=n/3;
 for (i=2;i*i*i<=n;i++)
  if (n%i==0) {
     nn=n/i;
    for (a=1;a<=i/2;a++) {
       b=i-a;
       d=(a+b)*(a+b)-4*(a*b-nn);
      // cout<<i<<' '<<a<<' '<<b<<' '<<d<<endl;
       if (d>0 && int64_t(sqrt(d))* int64_t(sqrt(d))==d) {

       c=-(a+b)+int(sqrt(d));
       //cout<<a<<' '<<b<<' '<<c/2<<endl;

       if (c/2>=b && c%2==0) { c=c/2;
                            if (a==b && a==c) t++; else
                             if (a==b || a==c || b==c) t+=3;
                             else t+=6;
                          }
                          }
     }
     }
 cout<<t;
 //system("pause");
}

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) > (b)) ? (b) : (a))
#define abs(a) (((a) > 0) ? (a) : (-(a)))

using namespace std;

long long result = 0;

void check (long long a, long long b, long long c, long long n) {
	if (a <= 0) return;
	if (b <= 0) return;
	if (c <= 0) return;
	if (a > b)  return;
	if (b > c)  return;
	long long inc=0;
	if (a == b && b == c) inc = 1; else
		if (a == b || b == c) inc = 3; else
										inc = 6;
	if (a*a*a + b*b*b + c*c*c + n == (a+b+c)*(a+b+c)*(a+b+c)) result += inc;
}

int main () {
	long long n;
	cin >> n;
	if (n%3 != 0) { cout << "0"; return 0;}
	n /= 3;
	for (long long x = 1; x*x*x <= n; x++)
		if (n%x == 0) {
			long long t = n/x;
			for (long long a = 1; a <= x/2; a++) {
				long long b = x-a;
				long long D = (a+b)*(a+b)-4*(a*b-t);
				if (D < 0) continue;
				long long q = (long long) sqrt(D);
				if (q*q != D) continue;
				if (D == 0) {
					long long c = (-(a+b))/2;
					check(a, b, c, n*3);
				}
				else {
					long long c = (-(a+b)+q)/2;
					check(a, b, c, n*3);
					c = (-(a+b)-q)/2;
					check(a, b, c, n*3);
				}
			}
		}
	cout << result;
}

#include<bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
typedef long long int ll;
typedef double lf;

const int inf = 987654321;
const ll INF = 123456789987654321;

#define pb push_back
#define rs resize
#define cl clear

ll N;
vector<ll> d;
int main() {
    scanf("%I64d", &N);
    if(N%3) printf("0");
    else {
        N/=3;
        for(ll i = 1; i <= sqrt(N); i++) {
            if(N%i==0) {
                d.pb(i);
                if(i*i==N) d.pb(N/i);
            }
        }

        ll cnt = 0;
        for(int i = 0; i < d.size(); i++) {
            ll a = d[i];
            for(int j = 0; j < d.size(); j++) {
                ll b = d[j];
                if(N%(a*b)) continue;
                ll c = N/(a*b);
                if(a+b<=c||b+c<=a||c+a<=b) continue;
                if((a+b+c)%2) continue;
                cnt++;
            }
        }
        printf("%I64d", cnt);
    }
}

#include<cstdio>

#define MAX 23208
const int MAXX(MAX<<1);

long long n;
int ans;
int a,b,c;
int i,j,k;
bool the[MAXX];

inline bool check()
{
}

int main()
{
    scanf("%I64d",&n);
    if(n%3ll)
        puts("0");
    else
    {
        n/=3ll;
        for(i=2;i<MAXX;++i)
            if(n%i==0)
                the[i]=true;
        for(a=1;a<MAX;++a)
            for(b=a;b<MAX;++b)
                if(the[a+b] && check())
                {
                }
        printf("%d\n",ans);
    }
    return 0;
}

#pragma comment(linker,"/STACK:64000000")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>
#include <map>
#include <set>
#include <ctime>
#include <algorithm>
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

#define WR printf
#define RE scanf
#define PB push_back
#define SE second
#define FI first

#define FOR(i,k,n) for(int i=(k); i<=(n); i++)
#define DFOR(i,k,n) for(int i=(k); i>=(n); i--)
#define SZ(a) (int)((a).size())
#define FA(i,v) FOR(i,0,SZ(v)-1)
#define RFA(i,v) DFOR(i,SZ(v)-1,0)
#define CLR(a) memset(a, 0, sizeof(a))

#define LL long long
#define VI  vector<int>
#define PAR pair<int ,int>
#define o_O 1000000000

void __never(int a){printf("\nOPS %d", a);}
#define ass(s) {if (!(s)) {__never(__LINE__);cout.flush();cerr.flush();abort();}}

LL n;

void sol()
{
	if (n%3 != 0)
	{
		cout << 0;
		return;
	}

	n/=3;

	LL ans = 0;
	for (LL a=1; a*a*a<=n; a++)
		if (n%a==0)
		{
			LL nn = n/a;
			LL bb = (LL)(sqrt((double)nn+5));
			while (bb*bb>n) bb--;
			for (LL b=bb; b>=a; b--)
				if (nn%b==0)
				{
					LL c = nn/b;
					// a <= b <= c
					// a+b > c
					if (a+b <= c) break;

					if (((a+b+c)&1)==0)
					{
						LL p = (a+b+c)/2;
						LL pa = p-a, pb = p-b, pc = p-c;
						if (pa>0 && pb>0 && pc>0)
						{
							if (pa!=pb && pa!=pc && pb!=pc) ans += 6;
							else if (pa==pb && pa==pc) ans++;
							else ans += 3;
						}
					}
				}
		}

	cout << ans;
}

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

	cin >> n;

	sol();
	return 0;
}

#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <cmath>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-7
#define maxm 200000000
#define MAXN 33
#define inf 1000000000
//const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi 3.1415926535
using namespace std;
__int64 a[1000000];
int l;
void get(__int64 n)
{
      __int64 k=(__int64)sqrt((double)n);
      __int64 i;
      l=0;
      for (i=2;i<=k;i++)
      {
          if (n%i==0)
          {
              a[l++]=i;
          }
      }
}
int main()
{
    //freopen("E:\\in.txt","r",stdin);
    //freopen("E:\\out.txt","w",stdout);
    __int64 n;
   while(scanf("%I64d",&n)!=EOF)
   {
    if (n%3)
    {
        printf("0\n");
        continue;
    }
    n/=3;
    get(n);
    //printf("%d\n",l);
    __int64 x,y,z;
     int i,j;
     int ans=0;
     for (i=0;i<l;i++)
     {
         for (j=i;j<l;j++)
         {
            x=a[i];
            y=a[j];
            z=n/x;
            if(z%a[j]) continue;
            z/=a[j];
            if(z<y) break;
            if((x+y-z)<0||(x+y-z)%2==1) continue;
            if((x+z-y)<0||(x+z-y)%2==1) continue;
            if((z+y-x)<0||(y+z-x)%2==1) continue;
            if(a[i]==a[j]&&a[i]==z)
            ans++;
            else if(x==y||x==z||y==z)
            {
                 ans+=3;
            }
            else ans+=6;
         }
     }
     printf("%d\n",ans);
   }
    return 0;
}

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<set>
#include<utility>
#include<string>
#include<set>
#define LL long long
#define eps 1e-9
using namespace std;

LL fac[1000005];
LL solve(LL a, LL b,LL t,LL li){
    LL c = 0;
    LL delta = (a+b)*(a+b) - 4*(a*b-t);
    LL sq =  (LL)sqrt(delta)*(LL)sqrt(delta);

    if(delta < 0) return 0;
    if(sq != delta) return 0;
    LL up = -(a+b)+sqrt(delta);
    if(up > 0 && up%2 == 0) c = up/2;

    if(!c) return 0;
    if(a == b && b==c)return 1;
    if(c <= b) return 0;
    if(a==b || b==c || a==c) return 3;
    return 6;
}

int main(){
    LL n,p=0,a,b,c,ans = 0;
    scanf("%I64d", &n);
    if(n%3){printf("0\n"); return 0;}
    n/=3;
    for(LL i=1; i*i*i<=n;i++) if(n%i == 0)fac[p++] = i;

    for(int i=0; i<p;i++){
        for(int j=1; j+j <= fac[i]; j++){
            a = j; b = fac[i]-j;
            ans+=solve(a,b,n/fac[i], fac[i]/2);
        }
    }
    printf("%I64d\n", ans);
    return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

unsigned long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0 || n<=20) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

//  m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<=n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 )
         {
          bpc=g[j];
          cpa=dar/g[j];

            if (  (apb+bpc<=cpa) || (bpc+cpa<=apb) || (cpa+apb<=bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
typedef long long LL;
using std::max;
int main()
{
    LL n;
    while(~scanf("%I64d",&n))
    {
          if(n%3!=0)
          {
             printf("0\n");
             continue;
          }
          n/=3;
          LL ret=0;
          for(LL i=2;i*i*i<=n;i++)
          {
                if(n%i!=0)continue;
                LL nn=n/i;
                //LL up=(LL)sqrt((double)nn);
                LL q=(-i+sqrt(double(i*i+4*nn)))/2;
                for(LL j=max(i,q);j*j<=nn;j++)
                {
                    if(nn%j!=0)continue;
                    LL z=nn/j;
                    if(i+j<z+2)continue;
                    if((i+j-z)%2||(i+z-j)%2||(z+j-i)%2)continue;
                    LL a=(i+j-z)/2,b=(j+z-i)/2,c=(i+z-j)/2;
                    if(a==b)
                    {
                       if(b==c)
                          ret++;
                       else
                          ret+=3;
                    }
                    else
                    {
                       if(b==c)
                          ret+=3;
                       else
                          ret+=6;
                    }
                }
          }
          printf("%I64d\n",ret);
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  ll n; cin >> n;
  if (n % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  n /= 3;
  if (n % 2 != 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<ll> divisors;
  for (ll i = 1; i * i <= n; i ++) {
    if (n % i == 0) divisors.push_back(i);
  }
  ll c = 0;
  for (ll r = 1; r * r * r <= n; r ++) {
    if (n % r != 0) continue;
    auto it = divisors.begin();
    ll l = *it;
    while (it != divisors.end() && r * l * l <= n) {
      if (l < r) {
              advance(it, 1);
              l = *it;
              continue;
      }
      if (n % (r * l) != 0) {      advance(it, 1);
      l = *it; continue;}
      ll t = n / (r * l);
      if (r > l || l > t) {      advance(it, 1);
      l = *it; continue;}
      if ((r + l + t) % 2 != 0) {      advance(it, 1);
      l = *it;continue;}
      ll u = (r + l + t) / 2;
      ll x = u - t;
      ll y = u - l;
      ll z = u - r;
      if (x > 0 && y > 0 && z > 0) {
        if (x != y && y != z) c += 6;
        else if ((x == y && y != z) || (x != y && y == z)) c += 2;
        else c ++;
      }
      advance(it, 1);
      l = *it;
    }
  }
  cout << c << endl;
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

// m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if (  (apb+bpc<cpa) || (bpc+cpa<apb) || (cpa+apb<bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <cstring>
#include <string>
#include <list>

using namespace std;

#define LL long long
#define FOR(i, a, b) for(int i = a, _b = b; i <= _b; i++)
#define FO(i, a, b) for(int i = a, _b = b; i < _b; i++)
#define FORD(i, a, b) for(int i = a, _b = b; i >= _b; i--)
#define FOD(i, a, b) for(int i = a; i > b; i--)
#define FORV(i, v) for(typeof(v.begin())i = v.begin(); i != v.end(); i++)
#define pb push_back
#define mp make_pair

#define sqr(x) ((x)*(x))

const double eps = 1e-8;
const double pi = 2*acos(0.0);
const string alphabetU = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string alphabetL = "abcdefghijklmnopqrstuvwxyz";
const LL infinite = 1000000000;

const LL maxn = 100010;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef unsigned int u32;

static const int m37pos[] = {
    32,  0,  1, 26,  2, 23, 27,  0,  3,
    16, 24, 30, 28, 11,  0, 13,  4,  7,
    17,  0, 25, 22, 31, 15, 29, 10, 12,
     6,  0, 21, 14,  9,  5, 20,  8, 19, 18
};

//************************ I/O ****************************
inline int nextInt(){
    int x = 0;
    register int c = getc(stdin);
    int sign = 0;
    for( ; ((c < 48 || c > 57) && c != '-'); c = getc(stdin));
    if(c == '-'){
        sign = 1;
        c = getc(stdin);
    }
    for( ; c > 47 && c < 58; c = getc(stdin)) x = (x<<1) + (x<<3) + c - 48;
    if (sign) x = -x;
    return x;
}
inline LL nextLong(){
    LL x = 0;
    register int c = getc(stdin);
    int sign = 0;
    for( ; ((c < 48 || c > 57) && c != '-'); c = getc(stdin));
    if(c == '-'){
        sign = 1;
        c = getc(stdin);
    }
    for( ; c > 47 && c < 58; c = getc(stdin)) x = (x<<1) + (x<<3) + c - 48;
    if (sign) x = -x;
    return x;
}
inline string nextLine(){
    string s;
    while(!feof(stdin)){
        char c = fgetc(stdin);
        if(c == 13) continue;
        if(c == 10) return s;
        s += c;
    }
    return s;
}
void scan(int &x){
    x = nextInt();
}
void scanl(LL &x){
    x = nextLong();
}
void scans(string &s){
    s = nextLine();
}
//************************ END I/O ************************

LL n, ans;
vector<LL> v;
int t;

void input(){
    cin>>n;
}

void cal(LL x, LL y, LL z){
    LL a, b, c, k;
    k = x - y + z;
    if (k%2) return;
    b = k/2;
    a = x - b;
    c = z - b;
    if (a > 0 && b > 0 && c > 0){
        if (a == b && b == c) ans++;
        else ans += 6;
    }
}

void process(){
    if (n%3){
        cout<<"0";
        return;
    }
    n /= 3;
    for (LL i = 1; i*i <= n; i++)
        if (n%i == 0) v.pb(i);

    ans = 0;
    LL k, l;
    for (int i = 0; i < v.size(); i++){
        k = n/v[i];
        for (int j = i; j < v.size(); j++){
            if (k%v[j]) continue;
            l = k/v[j];
            if (l < v[j]) break;
            cal(v[i], v[j], l);
        }
    }
    cout<<ans;
}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
    #endif
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    int test = 1;
    //test = nextInt();
    FOR (i, 1, test){
        //printf("Case %d:\n", i);
        input();
        process();
    }
    return 0;
}

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) > (b)) ? (b) : (a))
#define abs(a) (((a) > 0) ? (a) : (-(a)))

using namespace std;

long long result = 0;

void check (long long a, long long b, long long c, long long n) {
	if (a <= 0) return;
	if (b <= 0) return;
	if (c <= 0) return;
	if (a < b)  return;
	if (b < c)  return;
	long long inc=0;
	if (a == b && b == c) inc = 1; else
		if (a == b || b == c) inc = 3; else
										inc = 6;
	if (a*a*a + b*b*b + c*c*c + n == (a+b+c)*(a+b+c)*(a+b+c)) result += inc;
}

int main () {
	long long n;
	cin >> n;
	n /= 3;
	for (long long x = 1; x*x*x <= 100000000000000; x++)
		if (n%x == 0) {
			long long t = n/x;
			for (long long a = x/2; a <= x; a++) {
				long long b = x-a;
				long long D = (a+b)*(a+b)-4*(a*b-t);
				if (D < 0) continue;
				long long q = (long long) sqrt(D);
				if (q*q != D) continue;
				if (D == 0) {
					long long c = (-(a+b))/2;
					check(a, b, c, n*3);
				}
				else {
					long long c = (-(a+b)+q)/2;
					check(a, b, c, n*3);
					c = (-(a+b)-q)/2;
					check(a, b, c, n*3);
				}
			}
		}
	cout << result;
}

#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);

void solv()
{
    long long n;
    cin >> n;
    if (n % 3 != 0)
    {
        cout << 0 << endl;
        return;
    }
    n /= 3;
    vector<long long> v;
    for (long long i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            v.push_back(i);
            if (i * i != n)
                v.push_back(n / i);
        }
    }
    sort(v.begin(), v.end());
    int ans = 0;
    long double nn = n;
    for (int i = 0; i < v.size(); ++i)
    {
        long long x = v[i];
        if (1 > nn / x / x / x)
            break;
        for (int j = i; j < v.size(); ++j)
        {
            long long y = v[j];
            if (1 > nn / x / y / y)
                break;
            long long z = n / x;
            if (z % y != 0)
                continue;
            z /= y;
            long long c = x + y - z;
            if (c % 2 != 0)
                continue;
            c /= 2;
            long long a = x - c;
            long long b = y - c;
            if (a > 0 && b > 0 && c > 0)
            {
                if (a == b && b == c)
                    ++ans;
                else if (a == b || b == c || a == c)
                    ans += 2;
                else
                    ans += 6;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) > (b)) ? (b) : (a))
#define abs(a) (((a) > 0) ? (a) : (-(a)))

using namespace std;

//bool sync_with_stdio(bool sync = true);

const int MaxN = 100000;

pair<int, int> one[MaxN], two[MaxN];

vector<int> answer;

bool comp (pair<int, int> a, pair<int, int> b) {
	return a.first > b.first;
}

int main () {
	answer.clear();
	int n, v;
	int sz1=0, sz2=0;
	scanf ("%d%d", &n, &v);
	for (int i = 0; i < n; i++) {
		int type, weight;
		scanf ("%d%d", &type, &weight);
		if (type == 1) {one[sz1].first = weight; one[sz1++].second = i+1;}
		if (type == 2) {two[sz2].first = weight; two[sz2++].second = i+1;}
	}
	sort(one, one+sz1, comp);
	sort(two, two+sz2, comp);
	int p1=0, p2=0;
	int sum = 0;
	int nLast, szLast;
	while (v >= 2) {
		if (p1 == sz1 && p2 == sz2) break;
		int tryOne, tryTwo;
		if (p1 == sz1)
			tryOne = -1;
		else
			if (p1 == sz1-1) {
				tryOne = one[p1].first;
				p1++;
			}
			else {
				tryOne = one[p1].first + one[p1+1].first;
				p1 += 2;
			}
		if (p2 == sz2)
			tryTwo = -1;
		else
			tryTwo = two[p2++].first;
		if (tryOne > tryTwo) {
			if (tryOne == one[p1-1].first) {
				answer.push_back(one[p1-1].second);
				nLast = 1;
				szLast = one[p1-1].first;
			}
			else {
				answer.push_back(one[p1-1].second);
				answer.push_back(one[p1-2].second);
				nLast = 1;
				szLast = one[p1-1].first;
			}
	 	} else {
			answer.push_back(two[p2-1].second);
			nLast = 2;
			szLast = two[p2-1].first;
		}
		sum += max(tryOne, tryTwo);
		cout << nLast << " " << szLast << endl;
		v-= 2;
	}
	bool ok = false;
	if ((p1 != sz1 && p2 != sz2) && v == 1 && nLast == 1) {
		bool f;
		if (p2 == sz2) f = false; else
			if (p1 == sz1) f = true; else
				if (two[p2].first-szLast > one[p1].first) f = true; else f = false;
		if (f && p2 != sz2 && szLast < two[p2].first) {
			sum += two[p2].first-szLast;
			answer.pop_back();
			answer.push_back(two[p2].second);
			v = 0;
			p1--;
			p2++;
			nLast = 2;
			szLast = two[p2-1].second;
		}
		if (!f && p1 != sz1) {
			sum += one[p1++].first;
			answer.push_back(one[p1-1].second);
			nLast = 1;
			szLast = one[p1-1].second;
		}
	}
	if ((p1 != sz1 && p2 != sz2) && nLast == 2 && v == 0 && p1 <= sz1-2) {
		if (szLast < one[p1].first + one[p1+1].first) {
			sum += one[p1].first + one[p1+1].first - szLast;
			answer.pop_back();
			answer.push_back(one[p1++].second);
			answer.push_back(one[p1++].second);
			v = 0;
			p2--;
			p1+=2;
		}
	}
	printf("%d\n", sum);
	for (int i = 0; i < answer.size(); i++)
		printf ("%d ", answer[i]);
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
#include <string>
#include <set>
#include <functional>
#include <numeric>
#include <sstream>
#include <stack>
#include <map>
#include <queue>

#define CL(arr, val)    memset(arr, val, sizeof(arr))
#define REP(i, n)       for((i) = 0; (i) < (n); ++(i))
#define FOR(i, l, h)    for((i) = (l); (i) <= (h); ++(i))
#define FORD(i, h, l)   for((i) = (h); (i) >= (l); --(i))
#define L(x)    (x) << 1
#define R(x)    (x) << 1 | 1
#define MID(l, r)   (l + r) >> 1
#define Min(x, y)   (x) < (y) ? (x) : (y)
#define Max(x, y)   (x) < (y) ? (y) : (x)
#define E(x)        (1 << (x))
#define iabs(x)     (x) < 0 ? -(x) : (x)
#define OUT(x)  printf("%lld\n", x)
#define Read()  freopen("data.in", "r", stdin)
#define Write() freopen("data.out", "w", stdout);

typedef long long LL;
const double eps = 1e-6;
const double PI = acos(-1.0);
const int inf = 0x1F1F1F1F;

using namespace std;

vector<LL> vc;

int main() {
    //Read();

    LL n, ans;
    LL i, j;
    while(~scanf("%I64d", &n)) {
        if(n%3) {
            puts("0");
            return 0;
        }
        vc.clear();
        n /= 3;

        for(i = 2; i*i <= n; ++i)  {
            if(n%i == 0)    vc.push_back(i);
        }

        ans = 0;
        for(i = 0; vc[i]*vc[i]*vc[i] <= n && i < int(vc.size()); ++i) {
            LL r = n/vc[i];
            for(j = i; vc[j]*vc[j] <= r && j < int(vc.size()); ++j) {
                if(r%vc[j]) continue;

                LL s = r/vc[j];
                if(vc[i] + vc[j] < s)   continue;

                if((vc[i] - s + vc[j])%2)   continue;

                LL a = (vc[i] - s + vc[j])/2;
                LL c = a - vc[i] + s;
                LL b = vc[i] - a;

                if(a == b && b == c)    ans ++;
                else if((a == b && b < c) || (a < b && b == c)) ans += 3;
                else if(a < b && b < c)   ans += 6;
            }
        }

        printf("%I64d\n", ans);
    }
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <math.h>
#include <stack>
#include <list>

#define pb push_back
using namespace std;

typedef long long Long;

Long n;

Long arr[100005];
int c5;

int find(Long a,Long b,Long c)
{
    Long arr[4];
    arr[0] = a;
    arr[1] = b;
    arr[2] = c;
    sort(arr,arr+3);

    if(arr[0]<arr[1]&&arr[1]<arr[2]) return 6;
    else if(arr[0]==arr[1]&&arr[1]<arr[2]) return 3;
    else if(arr[0]<arr[1]&&arr[1]==arr[2]) return 3;
    else return 1;

}

int main()
{

    cin>>n;
    n/=3;

    for(Long x=1;x*x<=n;x++) {
        if(n%x==0) {
            arr[c5++] = x;
            if(x*x!=n) arr[c5++] = n/x;
        }
    }
    sort(arr,arr+c5);
    Long x,y,z;
    int ans = 0,cnt=0;

    Long a,b,c;

    for(int i=0;i<c5;i++) {
        x = arr[i];
        for(int j=i;j<c5&&arr[i]*arr[j]*arr[j]<=n;j++) {
            if(n%(arr[i]*arr[j])==0) {
                y = arr[j];
                z = n/(arr[i]*arr[j]);
                if(x<=y<=z) {

                //cnt++;

                    if(x-y+z>0 && y-x+z>0 && y-z+x>0 && (x-y+z)%2==0) {
                        cnt++;

                        a = (x-y+z)/2;
                        b = (y-x+z)/2;
                        c = (y-z+x)/2;

                        ans+=find(a,b,c);

                    }

                }
            }
        }
    }
    printf("%d\n",ans);

    return 0;
}

#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <fstream>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define F first
#define S second
#define PB push_back
#define PF push front
#define MP make_pair
#define REP(x, n) for(int x=0; x<(n); ++x)
#define FOR(x, b, e) for(int x=b; x<=(e); ++x)
#define FORD(x, b, e) for(int x=b; x>=(e); --x)
#define VAR(v,n) __typeof(n) v=(n)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define MOD(x, n) ((x)%(n)+(n))%(n)
#define SZ(x) (int((x).size()))
#define ALL(x) ((x).begin()),((x).end())
#define SORT(v) sort((v).begin(),(v).end())
#define REV(v) reverse((v).begin(),(v).end())
#define UNIQUE(v) SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
LL GCD( LL a , LL b ) { while( b ) b ^= a ^= b ^= a %= b ; return a ; }
LL LCM( LL a , LL b ) { return a * ( b / GCD( a , b ) ) ; }

typedef vector<int>    VI;
typedef vector<string> VS;
typedef vector<VI>     VVI;
typedef vector<LL>     VLL;
typedef vector<bool>   VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII>    VPII;
typedef pair<LL, LL>   PLL;
typedef vector<PLL>    VPLL;

const double EPS = 10e-9;
const LL INF = (1LL << 30);

using namespace std;

template<typename T>
string toString(T t) {
    stringstream ss;
    ss << t;
    return ss.str();
}

LL isSquare(LL N) {
    LL lo = 1, hi = 2*sqrt(N);
    while(hi - lo > 1) {
        LL mid = (hi+lo) >> 1;

        LL res = mid*mid;
        if(res < N) {
            lo = mid;
        } else if(res > N) {
            hi = mid;
        } else {
            return mid;
        }
    }

    return lo;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    LL N;
    cin >> N;

    if(N % 3 != 0) {
        cout << 0 << endl;
    } else {
        N /= 3;
        int options = 0;
        for(LL i = 1; i*i*i <= N; i++) {
            if(N % i == 0) {
                LL left = N/i, to = i/2;
                for(LL a = 1; a <= to; a++) {
                    LL c = i-a;
                    LL d = (a-c)*(a-c);
                    LL sqr = isSquare(d+4*left);
                    if(sqr*sqr == d+4*left) {
                        LL b = (-(a+c)+sqr) >> 1;
                        if(a <= c && c <= b) {
                            if(a == b) {
                                if(b == c) {
                                    options += 1;
                                } else {
                                    options += 3;
                                }
                            } else {
                                if(b == c) {
                                    options += 3;
                                } else {
                                    options += 6;
                                }
                            }
                        }
                    }
                }
            }
        }
        cout << options << endl;
    }

    return 0;
}

#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <iomanip>

#define REP(i,n) for(int i=0;i<n;i++)
#define ll long long

using namespace std;
//clock_t start, stop;

ll n;

ll maX(ll x, ll y)
{
	if(x>y)
		return x;
	else return y;
}

int main()
{
	//start = clock();

 /* Your code */

	//cin>>n;
	n = 30000000000000;
	//cout << n%3;
	if(n%3!=0) cout<<0<<endl;

	else
	{
		ll m=n/3;
		ll a,b,c,ub;
		ll x,y,z;

		ll j=0;
		ll res=0;

		while(j*j*j<=m) j++;

		//cout<<"geldim"<<endl;

		for(a=j-1; a>1;a--)
		{
			if(m%a==0)
			{
					//ub=1;
					ub= (ll)sqrt(m/a);

					for(b=ub;b>=maX(ub-a,a);b--)
					{
						if(m%(a*b)==0)
						{
								c=m/(a*b);

								if( ( (a+b+c) % 2 ) !=0 ) continue;
								else
								{
									ll sum=(a+b+c)/2;
									x=sum-a;
									y=sum-b;
									z=sum-c;

									if(x<=0||y<=0||z<=0) continue;

									if(x==y&&y==z&&x==z)
										res++;

									else if(x==z)
										res+=3;

									else if(y==z)
										res+=3;

									else if (x==y)
										res+=3;

									else res+=6;

									//cout<<"x: "<<x<<"  y: "<<y<<"  z:"<<z<<"  res:"<<res<<endl;
								}

						}
					}
			}

		}

		cout<<res<<endl;
	}

	//stop = clock();

	//printf("Run time: %g",(stop-start)/(double)CLOCKS_PER_SEC);

	//system("PAUSE");

	return 0;
}

#include <stdio.h>
#include <math.h>

__int64 n;

int main()
{
    scanf("%I64d", &n);
    if (n % 3 != 0)
       printf("0\n");
    else
    {
        int ans = 0;
        n /= 3;
        for (__int64 ab = 2; ab * ab * ab <= n; ab++)
            if (n % ab == 0)
            {
                  __int64 temp = n / ab;
                  __int64 tt = (__int64)sqrt((double)temp);
                  for (__int64 bc = tt; bc >= ab; bc--)
                      if (temp % bc == 0)
                      {
                          __int64 ca = temp / bc;
                          if ((ab + bc + ca) % 2 != 0) continue;
                          if (ab + bc < ca) break;
                          if (ab == bc && bc == ca)
                             ans += 1;
                          else
                          if (ab == bc || ab == ca || ca == bc)
                             ans += 3;
                          else
                             ans += 6;
                      }
            }
        printf("%d\n", ans);
    }
   // for (;;);
    return 0;
}

#include<cstring>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define per(i,a,b) for (int i=(b)-1;i>=a;i--)
#define sz(a) (int) a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
//-----
const double eps = 1e-8;
const int inf = 0x7f7f7f7f;
const int N=1e5+5;
const int mod=1e9+7;
vector<ll> p;
void Init(ll n) {
	p.clear();
	for(ll i = 2;i*i <= n;i++) {
		if(n % i == 0) p.pb(i);
	}
}
int check(ll n,ll ab,ll ac) {
	if(n % (ab * ac)) return 0;
	ll bc = n / ab / ac;
	ll a = ab + ac - bc;
	if(a < 0 || a & 1)  return 0; a /= 2;
	ll b = ab - a,c = ac - a;
//	dd(ab),de(ac);
	if(a == b && b == c) return 1;
	if(a == b || a == c || b == c) return 3;
	return 6;
}
int main(){
	//freopen("test.in","r",stdin);
	ll n;scanf("%I64d",&n);
	if(n % 3) return !printf("0\n"); n/=3;
	Init(n);
	int ans = 0;
	//for(ll a_b = 2;a_b*a_b*a_b <= n;a_b++) {
	rep(i,0,p.size()){
		ll a_b = p[i];
		if(a_b*a_b*a_b > n) break;
		//for(ll a_c = a_b;a_b*a_c*a_c <= n;a_c++) {
		rep(j,i,p.size()){
			ll a_c = p[j];
			//dd(a_b),de(a_c);
			if(a_b*a_c*a_c > n) break;
			ans += check(n,a_b,a_c);
		}
	}
	printf("%d\n",ans);
	return 0;
}

#include<cstring>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define per(i,a,b) for (int i=(b)-1;i>=a;i--)
#define sz(a) (int) a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
//-----
const double eps = 1e-8;
const int inf = 0x7f7f7f7f;
const int N=1e5+5;
const int mod=1e9+7;
vector<ll> p;
void Init(ll n) {
	p.clear();
	for(ll i = 2;i*i <= n;i++) {
		if(n % i == 0) p.pb(i);
	}
}
int check(ll n,ll ab,ll ac) {
	if(n % (ab * ac)) return 0;
	ll bc = n / ab / ac;
	ll a = ab + ac - bc;
	if(a < 0 || a & 1 || a > ab)  return 0; a /= 2;
	ll b = ab - a,c = ac - a;
//	dd(ab),de(ac);
	if(a == b && b == c) return 1;
	if(a == b || a == c || b == c) return 3;
	return 6;
}
int main(){
	//freopen("test.in","r",stdin);
	ll n;scanf("%I64d",&n);
	if(n % 3) return !printf("0\n"); n/=3;
	Init(n);
	ll ans = 0;
	//for(ll a_b = 2;a_b*a_b*a_b <= n;a_b++) {
	rep(i,0,p.size()){
		ll a_b = p[i];
		if(a_b*a_b > n/a_b) break;
		//for(ll a_c = a_b;a_b*a_c*a_c <= n;a_c++) {
		rep(j,i,p.size()){
			ll a_c = p[j];
			//dd(a_b),de(a_c);
			if(a_c*a_c > n/a_b) break;
			ans += check(n,a_b,a_c);
		}
	}
	printf("%I64d\n",ans);
	return 0;
}

#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;
#define repi(i, a) for(typeof((a).begin()) i = (a).begin(), _##i = (a).end(); i != _##i; ++i)

const int lim = 100100;
const int MAXQ = 10010000;

ll N;

int ans = 0;

void check(ll p, ll q) {
	ll r = N / p / q;
	ll a = p + r - q;
	ll b = p + q - r;
	ll c = q + r - p;
	if (a > 0 && b > 0 && c > 0 && a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		int num = 3;
		if (a == b) --num;
		if (b == c) --num;
		if (num == 1) {
			ans += 1;
		} else if (num == 2) {
			ans += 3;
		} else if (num == 3) {
			ans += 6;
		}
	}
}

int nxt[MAXQ];
int main() {
	cin >> N;
	if (N % 3) {
		cout << "0\n";
		return 0;
	}
	N /= 3;

	int prv = 0;
	for(ll q = 1; q * q <= N; ++q) {
		if (N % q == 0) {
			nxt[prv] = q;
			prv = q;
		}
	}
	nxt[prv] = N;

	for(int p = 1; p <= lim; ++p) {
		if (N % p == 0) {
			ll m = N / p;
			for (ll q = p; q * q <= m; q = nxt[q]) {
				if (m % q == 0) {
					check(p, q);
				}
			}
		}
	}

	cout << ans << "\n";
}

#include<bits/stdc++.h>
using namespace std;

#define int long long int
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB emplace_back
#define endl "\n"
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
const int N = 1005000;

int power(int x,int y,int m=mod){int res=1;x=x%m;while(y>0){if(y&1)res=(res*x)%m;y=y>>1;x=(x*x)%m;}return res;}
int ncr(int n,int r){if(n<r)return 0;int p=1,k=1;if(n-r<r)r=n-r;if(r!=0){while(r){p*=n;k*=r;int g=__gcd(p, k);p/=g;k/=g;n--;r--;}}else p=1;return p;}
//cout<<fixed<<setprecision(8)<<x<<endl;

signed main()
{
	fast;
    //int t=1; cin>>t; while(t--)
    {
    	int n;
    	cin>>n;

    	if(n%3)
    		return cout<<"No\n",0;

    	n/=3;
    	vector<int> v;
    	for(int i=2;i*i<=n;i++)
    	{
    		if(n%i==0)
    		{
    			v.PB(i);
    			if(i!=n/i)
    				v.PB(n/i);
    		}
    	}

    	int ans=0;
    	sort(v.begin(),v.end());
    	int nv=v.size();

    	for(int i=0;i<nv;i++)
    	{
    		for(int j=i;j<nv && v[i]*v[j]<=n;j++)
    		{
    			int a=v[i];
    			int b=v[j];
    			int c=n/(a*b);

    			if(c<b || (a+b-c)%2 || a+b<=c || n%(a*b))
    				continue;

    			int ac=(a+b-c)/2;
    			int bc=a-ac;
    			int cc=b-ac;

    			//cout<<a<<" "<<b<<" "<<c<<endl;
    			//cout<<i<<" "<<j<<" "<<ac<<" "<<bc<<" "<<cc<<endl;
    			if(ac==bc && bc==cc)
    				ans+=1;
    			else if(ac==bc || bc==cc)
    				ans+=3;
    			else
    				ans+=6;

    		}
    	}

    	cout<<ans<<endl;

    }
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}

#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <cmath>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-7
#define maxm 200000000
#define MAXN 33
#define inf 1000000000
//const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi 3.1415926535
using namespace std;
__int64 a[1000000];
int l;
void get(__int64 n)
{
      __int64 k=(__int64)sqrt((double)n);
      __int64 i;
      l=0;
      for (i=2;i<=k;i++)
      {
          if (n%i==0)
          {
              a[l++]=i;
          }
      }
}
int main()
{
    //freopen("E:\\in.txt","r",stdin);
    //freopen("E:\\out.txt","w",stdout);
    __int64 n;
   while(scanf("%I64d",&n)!=EOF)
   {
    if (n%3)
    {
        printf("0\n");
        continue;
    }
    n/=3;
    get(n);
    //printf("%d\n",l);
    __int64 x,y,z;
     int i,j;
     int ans=0;
     for (i=0;i<l;i++)
     {
         for (j=i;j<l;j++)
         {
            x=a[i];
            y=a[j];
            z=n/x;
            if(z%a[j]) continue;
            z/=a[j];
            if(z<y) break;
            if((x+y-z)<0||(x+y-z)%2==1) continue;
            if((x+z-y)<0||(x+z-y)%2==1) continue;
            if((z+y-x)<0||(y+z-x)%2==1) continue;
            if(a[i]==a[j]&&a[i]==z)
            ans++;
            else if(x==y||x==z||y==z)
            {
                 ans+=3;
            }
            else ans+=6;
         }
     }
     printf("%d\n",ans);
   }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);

void solv()
{
    long long n;
    cin >> n;
    if (n % 3 != 0)
    {
        cout << 0 << endl;
        return;
    }
    n /= 3;
    vector<long long> v;
    for (long long i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            v.push_back(i);
            if (i * i != n)
                v.push_back(n / i);
        }
    }
    sort(v.begin(), v.end());
    int ans = 0;
    long double nn = n;
    for (int i = 0; i < v.size(); ++i)
    {
        long long x = v[i];
        if (0.9 > nn / x / x / x)
        {
            break;
        }
        for (int j = i; j < v.size(); ++j)
        {
            long long y = v[j];
            if (0.9 > nn / x / y / y)
            {
                break;
            }
            long long z = n / x;
            if (z % y != 0)
                continue;
            z /= y;
            if (y > z)
                continue;
            long long c = x + y - z;
            if (c % 2 != 0)
                continue;
            c /= 2;
            long long a = x - c;
            long long b = y - c;
            if (a > 0 && b > 0 && c > 0)
            {
                if (a == b && b == c)
                    ++ans;
                else if (a == b || b == c || a == c)
                    ans += 2;
                else
                    ans += 6;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}

#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
typedef __int64 i64;
i64 gao(i64 k1,i64 k2)
{
    i64 k=k1*k1-k2*4;
    if(k==0)    return 1;
    i64 kk=sqrt(k+0.5);
    if(kk*kk!=k)    return 0;
    return 2;
}
i64 half(i64 m,i64 k)
{
    i64 kk=k*k,x=0,y=(int(sqrt(m+0.5)));
    while(y>x)
    {
        i64 i=x+(y-x)/2;
        if((m-i*(i+k))*4<=kk)
            y=i;
        else
            x=i+1;
    }
    return y;
}
i64 ask(i64 m,i64 k)
{
    i64 res=0;
    for(i64 i=half(m,k);i*(i+k)<m;++i)
        res+=gao(k,m-i*(i+k));
    return res;
}
i64 cal(i64 n)
{
    if(n%3) return 0;
    n/=3;
    i64 res=0;
    for(i64 i=2;i*i<n;++i)if(n%i==0)
        res+=ask(n/i,i);
    return res;
}
int main()
{
    i64 n;
    cin>>n;
    cout<<cal(n)<<endl;
    return 0;
}

#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#define int64 long long
#define For(i,x,y) for (i=x;i<=y;i++)
using namespace std;
int64 i,j,k,n,m,an;
inline int work(int a,int b,int c) {
	return a==b&&b==c?1:a==b||b==c?3:6;
}
int main() {
	scanf("%I64d",&n);
	if (n%3) {
		printf("0\n"); return 0;
	}
	n/=3;
	int A=(int)(pow(n,1./3)+1e-9);
	For(i,2,A) if (n%i==0) {
		int B=int(sqrt(n/i)+1e-9);
		for(j=B;j>=i;j--) if (n/i%j==0) {
			int C=n/i/j;
			if (i+j<C) break;
			if (j<=C&&(i+j+C)%2==0) {
				int D=(i+j+C)/2;
				an+=work(D-C,D-j,D-i);
			}
		}
	}
	printf("%I64d\n",an);
	//for(;;);
	return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

unsigned long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0 || n<=20) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

//  m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if (  (apb+bpc<=cpa) || (bpc+cpa<=apb) || (cpa+apb<=bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

//  m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if (  (apb+bpc<cpa) || (bpc+cpa<apb) || (cpa+apb<bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <iostream>
#include <cmath>

using namespace std;

long long n;
int ans, cnt, nums[50005];;

int main()
{
  while (cin >> n) {
		if (n % 3) {
			cout << 0 << endl;
			continue;
		}
		n /= 3;
		ans = cnt = 0;
		for (int i = 1; i <= 50000; ++i)
			if ((4 * n) % i == 0)
				nums[cnt++] = i;
		for (int a = 1; 8LL * a * a * a <= n; ++a) {
			for (int i = 0; i < cnt; ++i) {
				int b = nums[i] - a;
				if (b < a)
					continue;
				if (2LL * b * (a + b) * (a + b) > n)
					continue;
				long long t = 1LL * (a + b) * (a + b) * (a - b) * (a - b) + 4LL * n * (a + b);
				long long k = (long long)sqrt(1.0 * t);
				if (k * k == t) {
					long long c = 0LL - a - b + k / (a + b);
					if ((c & 1) || (c < 2 * b))
							continue;
					c >>= 1;
					int temp = 6;
					if (a == b) {
						if (b == c)
							temp /= 6;
						else
							temp /= 2;
					}
					ans += temp;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

// m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i+1;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if (  (apb+bpc<cpa) || (bpc+cpa<apb) || (cpa+apb<bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <stdio.h>
long long divs[100001];
//93163582512000

int main(){
        long long i=0, n, sum=0, zz=0, a, b, c;
        int j=0, ij=0, m=0;
        scanf ("%lld", &n);
        if (n%3!=0)     {printf ("%d\n", 0); return 0;}
        n/=3;

        for (i=1;2*i*i<n;i++){
                if (n%i==0) {
                        divs[m]=i;
                        m++;
                }
        }

        for (i=0;i<=m;i++){
                ij=m-1, j=0;
                while (j<m && ij>=0){
                        zz=divs[i]*divs[j]*divs[ij];
                        if (zz>n) ij--;
                        else if (zz<n) j++;
                        else {
                                //printf ("%lld %lld %lld\n", divs[i], divs[j], divs[ij]);
                                a=divs[i]+divs[j]-divs[ij];
                                b=divs[i]+divs[ij]-divs[j];
                                c=divs[j]+divs[ij]-divs[i];
                                if (a>0 && b>0 && c>0 && a%2==0 && b%2==0 && c%2==0){
                                        sum++;
                                }
                                ij--, j++;
                        }
                }
        }
        printf ("%lld\n", sum);

return 0;}

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

vector<long long> enum_divisors(long long n) {
    vector<long long> res;
    for (long long i = 1LL; i * i <= n; i++) {
        if (n % i != 0) continue;
        res.emplace_back(i);
        // if (i != n / i) res.emplace_back(n / i);
    }
    // sort(res.begin(), res.end());
    return res;
}

int main() {
    long long n; cin >> n;
    if (n % 3) return !(cout << 0 << endl);
    n /= 3;
    auto ds = enum_divisors(n);
    long long cnt = 0;
    for (long long x: ds) for (long long y: ds) if (x <= y) {
        if (n / x % y) continue;
        long long z = n / x / y;
        if (y > z) continue;
        long long s = x + y + z;
        if (s % 2) continue;
        s /= 2;
        long long a = s - y, b = s - z, c = s - x;
        if (a <= 0 || b <= 0 || c <= 0) continue;
             if (a == b && b == c) cnt += 1;
        else if (a == b || b == c) cnt += 3;
        else                       cnt += 6;
    }
    cout << cnt << endl;
    return 0;
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <set>
#define MAXN 100010
#define INF 1000000007
#define MP(x,y) make_pair(x,y)
#define FI first
#define SE second
#define EPS 1e-8
using namespace std;
int yi[MAXN];
int main()
{
    //freopen("/home/moor/Code/input","r",stdin);
    long long n,tt;
    while(cin>>n)
    {
        int ans=0,a,b,c,tmp;
        if(n%3==0)
        {
            n/=3;
            int cnt=0;
            for(long long i=2;i*i<=n;++i)
                if(n%i==0)
                   yi[cnt++]=i;
            for(int i=0;i<cnt;++i)
                for(int j=i;j<cnt;++j)
                {
                    tt=(long long )(yi[i]*yi[j]);
                    if(n%tt==0&&n/tt>=yi[j])
                    {
                        tt=n/tt;
                        tmp=yi[i]+yi[j]+tt;
                        if(tmp&1)   continue;
                        if(yi[i]+yi[j]<=tt)  continue;
                        tmp/=2;
                        a=tmp-tt,b=tmp-yi[j],c=tmp-yi[i];
                        if(a==c)    ++ans;
                        else    ans+=a==b?3:6;
                    }
                }
        }
        printf("%d\n",ans);
    }
    return 0;
}

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<set>
#include<utility>
#include<string>
#include<set>
#define LL long long
#define eps 1e-9
using namespace std;

LL fac[1000005];
LL solve(LL a, LL b,LL t,LL li){
    LL c = 0;
    LL delta = (a+b)*(a+b) - 4*(a*b-t);
    LL sq =  (LL)sqrt(delta)*(LL)sqrt(delta);

    if(delta < 0) return 0;
    if(sq != delta) return 0;
    LL up = -(a+b)+sqrt(delta);
    if(up > 0 && up%2 == 0) c = up/2;

    if(!c) return 0;
    if(a == b && b==c)return 1;
    if(c <= b) return 0;
    if(a==b || b==c || a==c) return 3;
    return 6;
}

int main(){
    LL n,p=0,a,b,c,ans = 0;
    scanf("%I64d", &n);
    if(n%3){printf("0\n"); return 0;}
    n/=3;
    for(LL i=1; i*i*i<=n;i++) if(n%i == 0)fac[p++] = i;

    for(int i=0; i<p;i++){
        for(int j=1; j+j <= fac[i]; j++){
            a = j; b = fac[i]-j;
            ans+=solve(a,b,n/fac[i], fac[i]/2);
        }
    }
    printf("%I64d\n", ans);
    return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <ctime>

using namespace std;

void Solve();

int main()
{
	Solve();
}
/********************************it ends here*******************************/

typedef long long LL;
LL n;
int a[10000010], cnt;

inline bool check(int x, int y, int z)
{
	if (x + y <= z)
		return 0;
	if (x + z <= y)
		return 0;
	if (y + z <= x)
		return 0;
	return 1;
}

void Solve()
{
	cin >> n;
	if (n % 3) {
		cout << 0 << endl;
		return ;
	}
	n /= 3;
	int bnd = int(sqrt(n));
	for (int i = 1; i <= bnd; ++i)
		if (n % i == 0)
			a[++cnt] = i;

	LL ans = 0;
	for (int i = 1; i <= cnt; ++i) {
		LL t = n / a[i];
		for (int j = i; j <= cnt; ++j) {
			LL z = t / a[j];
			if (z * a[j] != t) continue;
			if (z < a[j])
				break;
			if (a[i] + a[j] + z & 1)
				continue;
			if (!check(a[i], a[j], z))
				continue;
			if (a[i] == a[j]) {
				if (a[j] == z)
					++ans;
				else ans += 3;
			}
			else ans += 6;
		}
	}
	cout << ans << endl;

}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
typedef long long LL;
using std::max;
int main()
{
    LL n;
    while(~scanf("%I64d",&n))
    {
          if(n%3!=0)
          {
             printf("0\n");
             continue;
          }
          n/=3;
          LL ret=0;
          for(LL i=2;i*i*i<=n;i++)
          {
                if(n%i!=0)continue;
                LL nn=n/i;
                LL up=(LL)sqrt((double)nn);
                LL q=(-i+sqrt(double(i*i+4*nn)))/2;
                for(LL j=max(i,q);j<=up;j++)
                {
                    if(nn%j!=0)continue;
                    LL z=nn/j;
                    if(i+j<z+2)continue;
                    if((i+j-z)%2||(i+z-j)%2||(z+j-i)%2)continue;
                    LL a=(i+j-z)/2,b=(j+z-i)/2,c=(i+z-j)/2;
                    if(a==b)
                    {
                       if(b==c)
                          ret++;
                       else
                          ret+=3;
                    }
                    else
                    {
                       if(b==c)
                          ret+=3;
                       else
                          ret+=6;
                    }
                }
          }
          printf("%I64d\n",ret);
    }
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define pause cout << " press ansy key to continue...",  cin >> chh
#define file_r(x) freopen(x,  "r",  stdin)
#define file_w(x) freopen(x,  "w",  stdout)
#define lowbit(x) ((x) & (-x))
#define repit(i, c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, u) for (int i = head[u]; i != -1; i = nxt[i])
#define repd(i, n) for (int i = (n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = (n); i <= (m); i++)
#define FORD(i, n, m) for (int i = (n); i >= (m); i--)
#define pb push_back
#define X first
#define Y second
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(c) (c).size()
#define ALL(c) (c).begin(), (c).end()

using namespace std;
int chh;

typedef long long LL;
typedef vector<int> vi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;

LL n, ans;
vector<LL> a;

LL add(LL x, LL y, LL z) {
	if (x == y && y ==  z) return 1;
	if (x == y || x == z || y == z) return 3;
	return 6;
}

int main() {
	LL r, x, y, z, sz, cnt;
	while (cin >> n) {
		if (n % 3) {
			puts("0");
			continue;
		}
		n /= 3;
		a.clear();
		for (LL i = 2; i * i <= n; i++) {
			if (n % i) continue;
			a.pb(i), a.pb(n / i);
		}
		sort(ALL(a));
		sz = SZ(a);
//		cout << "sz= " << sz << endl;
		ans = 0;
		rep (i, sz) {
			x = a[i];
			if (x * x * x > n) break;
			FOR (j, i, sz) {
				y = a[j];
				if (n % (x * y)) continue;
				z = n / (x * y);
				if (z < y) break;
				if (z > x + y) continue;
				cnt = x % 2 + y % 2 + z % 2;
				if (cnt == 1 || cnt == 3) continue;
				ans += add(x, y, z);
//				cout << (x + y - z) / 2 << " " << (x + z - y) / 2 + " " << (y + z - z) / 2 << endl;
//				cout << x << " " << y << " " << z << endl;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

#include <algorithm>
#include <iostream>
#include <cstring>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <set>

using namespace std;

long long n, ab0, res;

int ND;
long long divs[1000];
int ndivs[1000], cur[1000];

void rec2(long long ac, int d)
{
   if (ab0*ac*ac > n) return;

   if (d == ND)
   {
      long long ab = ab0;
      if (ab > ac) return;
      long long bc = n / (ab * ac);

      long long a = (ac + ab - bc); if (a <= 0 || a%2 != 0) return;
      a /= 2;

      long long b = (ab + bc - ac); if (b%2 != 0) return;
      b /= 2;

      long long c = (ac + bc - ab); if (c%2 != 0) return;
      c /= 2;

      if (a == b && b == c) { ++res; return; }
      if (a == b || b == c) { res += 3; return; }
      res += 6;

      return;
   }

   for (int j = 0; j+cur[d] <= ndivs[d]; ++j) {
      cur[d] += j;
      rec2(ac, d+1);
      cur[d] -= j;
      ac *= divs[d];
   }
}

void rec1(long long ab, int d)
{
   if (ab*ab*ab > n) return;

   if (d == ND)
   {
      ab0 = ab;
      rec2(1, 0);
      return;
   }

   for (int j = 0; j <= ndivs[d]; ++j) {
      cur[d] += j;
      rec1(ab, d+1);
      cur[d] -= j;
      ab *= divs[d];
   }
}

void solve()
{
   if (n%3 != 0) { cout << 0 << endl; return; }

   n /= 3;
   long long nt = n;

   for (long long p = 2; p*p <= nt; ++p) {
      if (nt%p == 0) {
         divs[ND] = p;
         while (nt%p == 0) { nt /= p; ++ndivs[ND]; }
         ++ND;
      }
   }

   if (nt > 1) { divs[ND] = nt; ++ndivs[ND]; ++ND; }

   rec1(1, 0);
   cout << res << endl;
}

int main()
{
   //freopen("input.txt", "r", stdin);

   cin >> n;
   solve();

   return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

vector<long long> factor;
void getFactor(long long n)
{
    factor.clear();
    for(long long i = 1;i * i <= n;i++)
        if (n % i == 0)
            factor.push_back(i);

}

int main()
{
    long long n;

    scanf("%I64d", &n);
    if (n % 3)
    {
        printf("0\n");
        return 0;
    }
    n /= 3;
    getFactor(n);

    //printf("size %d\n", factor.size());
    long long res = 0;
    for(int i = 0;i < factor.size();i++)
    {
        long long a = n / factor[i];
        for(int j = 0;j <= i;j++)
        {
            if (a % factor[j]) continue;
            long long c = a / factor[j];
            if (c > factor[j]) continue;

            if (factor[i] >= factor[j] + c || ((factor[i] + c) - 2 * factor[j]) % 2)
                continue;

            //printf("%I64d %I64d %I64d\n", factor[i], factor[j], c);
            if (factor[i] == factor[j] && factor[j] == c)
                res++;
            else if (factor[i] == factor[j] || factor[j] == c)
                res += 3;
            else
                res += 6;
        }
    }
    printf("%I64d\n", res);
    return 0;
}

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define SIZE(v) ((int)(v).size())

#define BEGIN(v) ((v).begin())
#define END(v) ((v).end())
#define ALL(v) BEGIN(v),END(v)
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) SORT(v);(v).erase(unique(ALL(v)),END(v))

#define FOR(i,l,r) for(int i=(l);i<(r);i++)
#define FOREACH(i,v) for(typeof((v).begin()) i=(v).begin();i!=(v).end();i++)

vector <bool> tagPrime;
vector <int> prime;

void initPrime(int n) {
	tagPrime = vector <bool> (n + 1);
	tagPrime[0] = tagPrime[1] = true;
	prime.clear();
	for (int i = 2; i <= n; i++) {
		if (tagPrime[i]) continue;
		prime.push_back(i);
		if (i > n / i) continue;
		for (int j = i * i; j <= n; j += i) {
			tagPrime[j] = true;
		}
	}
}

long long n, res;
vector<long long> primeFactor;
vector<int> cnt;

void dfs(int depth, long long x, long long y) {
	if (depth == SIZE(cnt)) {
		long long z = n / x / y;
		res += x + y > z && x + z > y && y + z > x;
		return ;
	}
	vector<long long> pow(cnt[depth] + 1);
	pow[0] = 1;
	FOR(i, 0, cnt[depth]) pow[i + 1] = pow[i] * primeFactor[depth];
	if (primeFactor[depth] == 2) {
		dfs(depth + 1, x * pow[cnt[depth]], y);
		dfs(depth + 1, x, y * pow[cnt[depth]]);
		dfs(depth + 1, x, y);
		if (cnt[depth] < 3) return ;
		x <<= 1;
		y <<= 1;
		cnt[depth] -= 3;
	}
	FOR(i, 0, cnt[depth] + 1) {
		FOR(j, 0, cnt[depth] - i + 1) {
			dfs(depth + 1, x * pow[i], y * pow[j]);
		}
	}
}

int main() {
	initPrime(10000000);
	cin >> n;
	if (n % 3) {
		cout << 0 << endl;
	} else {
		n /= 3;
		long long tmp = n;
		FOREACH(it, prime) {
			if (*it > tmp / *it) break;
			primeFactor.push_back(*it);
			cnt.push_back(1);
			for (tmp /= *it; !(tmp % *it); tmp /= *it, cnt.back()++) ;
		}
		if (tmp > 1) {
			primeFactor.push_back(tmp);
			cnt.push_back(1);
		}
		dfs(0, 1, 1);
		cout << res << endl;
	}
	return 0;
}

#include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>

#include <ctime>
#include <deque>
#include <bitset>
#include <cctype>
#include <utility>
#include <cassert>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)
#define Fit(i,v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define Fitd(i,v) for(__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))

template<class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T r; ss >> r; return r; }
template<class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sqr(T x) { return x * x; }
template<class T> T cube(T x) { return x * x * x; }
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return s == 0 ? 0 : cntbit(s >> 1) + (s & 1); }
const int bfsz = 1 << 16; char bf[bfsz + 5]; int rsz = 0;int ptr = 0;
char gc() { if (rsz <= 0) { ptr = 0; rsz = (int) fread(bf, 1, bfsz, stdin); if (rsz <= 0) return EOF; } --rsz; return bf[ptr++]; }
void ga(char &c) { c = EOF; while (!isalpha(c)) c = gc(); }
int gs(char s[]) { int l = 0; char c = gc(); while (isspace(c)) c = gc(); while (c != EOF && !isspace(c)) { s[l++] = c; c = gc(); } s[l] = '\0'; return l; }
template<class T> bool gi(T &v) {
    v = 0; char c = gc(); while (c != EOF && c != '-' && !isdigit(c)) c = gc(); if (c == EOF) return false; bool neg = c == '-'; if (neg) c = gc();
    while (isdigit(c)) { v = v * 10 + c - '0'; c = gc(); } if (neg) v = -v; return true;
}

#define maxn 2000005
#define mod 1000000007

ll n;
vector<ll> V;
ll a, b, c;

int calcu(){
    if(c > a) return 0;
    if((a + b + c) * (a + b + c) * (a + b + c) - a * a * a - b * b * b - c * c * c != n) return 0;
    if(a == b && a == c) return 1;
    if(a == b) return 1;
    if(a == c) return 2;
    return 3;
}

int main(){
//  freopen("in.txt", "r", stdin);

    cin >> n;
    if(n % 3){
        cout << 0;
        return 0;
    }
    ll N = n / 3 * 4;

    for(int i = 2; i * 1ll * i <= N; i++) if(N % i == 0){
        if(i * 1ll * i == N) V.pb(i);
        else V.pb(i); V.pb(N / i);
    }

    sort(all(V));
    int run = 0;
    ll res = 0;
    for(a = 1; a * a * 6 <= n; a++){
        if(24 * a * a * a < n) continue;
        while(V[run] <= a) run++;
        for(int u = run;;u++){
            b = V[u] - a;
            if(b > a || 3 * a * a > n / b) break;
            ll d = (a - b) * (a - b) + N / (a + b);
            ll x = (ll)sqrt(d + 0.5);
            if(x * x != d) continue;
            if((x - a - b) > 0 && (x - a - b) % 2 == 0){
                c = (x - a - b) / 2;
            }
            res += calcu();
        }
    }
    cout << res;

    return 0;
}

/*http://www.cnblogs.com/Rlemon/default.html?page=5*/

#include<cstdio>
#include<cstring>
#include<cmath>

typedef long long int ll;

int main(void)
{
	int n;
	int x,y,z;
	int a,b,c;
	int n_3,n_x2;
	int ans=0;

	while(~scanf("%d",&n))
	{
		if( n%3==0)
		{
			ans=0;
			n/=3;

			//n開3次方
			n_3=(int) (pow( (double)n ,1.0/3)+0.5 );

			//枚舉x
			for(x=1;x<=n_3;x++)
			{
				//n不是x的倍數的話就不能當作解答
				if(n%x) continue;

				//x*y*y<=n
				n_x2= (int) (sqrt( (double) (n/x) )  +0.5);

				//枚舉y
				for(y=x;y<=n_x2;y++)
				{
					//x*y*z=n
					if( (n/x)%y) continue;
					z=n/x/y;

					//?
//			if(x+y<=z) break;

					//枚舉a
					//x= a+b ,y=a+c ,z=b+c
					//a無法是int
					if( (x+y-z)%2) continue;
					a=(x+y-z)/2;
					b=x-a;
					c=y-a;

					if(a<=0 ||  b<=0 || c<=0) continue;
					if(a==b && b==c)
					{
						ans+=1;
					//	printf("a=%d b=%d c=%d\n",a,b,c);
					}
					else if(a==b)
					{
					//	printf("a=%d b=%d c=%d\n",a,b,c);
						ans+=3;
					}
					else if(b==c)
					{
					//	printf("a=%d b=%d c=%d\n",a,b,c);
						ans+=3;
					}
					else ans+=6;
				}
			}
			printf("%d\n",ans);
		}
		else printf("0\n");
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define int long long int
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB emplace_back
#define endl "\n"
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
const int N = 1005000;

int power(int x,int y,int m=mod){int res=1;x=x%m;while(y>0){if(y&1)res=(res*x)%m;y=y>>1;x=(x*x)%m;}return res;}
int ncr(int n,int r){if(n<r)return 0;int p=1,k=1;if(n-r<r)r=n-r;if(r!=0){while(r){p*=n;k*=r;int g=__gcd(p, k);p/=g;k/=g;n--;r--;}}else p=1;return p;}
//cout<<fixed<<setprecision(8)<<x<<endl;

signed main()
{
	fast;
    //int t=1; cin>>t; while(t--)
    {
    	int n;
    	cin>>n;

    	if(n%3)
    		return cout<<"No\n",0;

    	n/=3;
    	vector<int> v;
    	for(int i=2;i*i<=n;i++)
    	{
    		if(n%i==0)
    		{
    			v.PB(i);
    			if(i!=n/i)
    				v.PB(n/i);
    		}
    	}

    	int ans=0;
    	sort(v.begin(),v.end());
    	int nv=v.size();

    	for(int i=0;i<nv;i++)
    	{
    		for(int j=i;j<nv && v[i]*v[j]<=n;j++)
    		{
    			int a=v[i];
    			int b=v[j];
    			int c=n/(a*b);

    			if(c<b || (a+b-c)%2 || a+b<=c || n%(a*b))
    				continue;

    			int ac=(a+b-c)/2;
    			int bc=a-ac;
    			int cc=b-ac;

    			//cout<<a<<" "<<b<<" "<<c<<endl;
    			//cout<<i<<" "<<j<<" "<<ac<<" "<<bc<<" "<<cc<<endl;
    			if(ac==bc && bc==cc)
    				ans+=1;
    			else if(ac==bc || bc==cc)
    				ans+=3;
    			else
    				ans+=6;

    		}
    	}

    	cout<<ans<<endl;

    }
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);

void solv()
{
    long long n;
    cin >> n;
    if (n % 3 != 0)
    {
        cout << 0 << endl;
        return;
    }
    n /= 3;
    vector<long long> v;
    for (long long i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            v.push_back(i);
            if (i * i != n)
                v.push_back(n / i);
        }
    }
    sort(v.begin(), v.end());
    int ans = 0;
    long double nn = n;
    for (int i = 0; i < v.size(); ++i)
    {
        long long x = v[i];
        if (1 > nn / x / x / x)
            continue;
        for (int j = i + 1; j < v.size(); ++j)
        {
            long long y = v[j];
            if (1 > n / x / y / y)
                continue;
            long long z = n / x;
            if (z % y != 0)
                continue;
            z /= y;
            long long c = x + y - z;
            if (c % 2 != 0)
                continue;
            c /= 2;
            long long a = x - c;
            long long b = y - c;
            if (a > 0 && b > 0 && c > 0)
            {
                if (a == b && b == c)
                    ++ans;
                else if (a == b || b == c || a == c)
                    ans += 2;
                else
                    ans += 6;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <ctime>

using namespace std;

void Solve();

int main()
{
	Solve();
}
/********************************it ends here*******************************/

typedef long long LL;
LL n;
int a[1000010], cnt;

inline bool check(int x, int y, int z)
{
	if (x + y <= z)
		return 0;
	if (x + z <= y)
		return 0;
	if (y + z <= x)
		return 0;
	return 1;
}

void Solve()
{
	cin >> n;
	if (n % 3) {
		cout << 0 << endl;
		return ;
	}
	n /= 3;
	int bnd = int(sqrt(n));
	for (int i = 1; i <= bnd; ++i)
		if (n % i == 0)
			a[++cnt] = i;

	LL ans = 0;
	for (int i = 1; i <= cnt; ++i) {
		LL t = n / a[i];
		for (int j = i; j <= cnt; ++j) {
			LL z = t / a[j];
			if (z * a[j] != t) continue;
			if (z < a[j])
				break;
			if (a[i] + a[j] + z & 1)
				continue;
			if (!check(a[i], a[j], z))
				continue;
			if (a[i] == a[j]) {
				if (a[j] == z)
					++ans;
				else ans += 3;
			}
			else ans += 6;
		}
	}
	cout << ans << endl;

}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std ;

#define FOREACH(it,c) for( __typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define FOR(i,a,b) for( int i=(a),_b=(b);i<=_b;i++)
#define DOW(i,b,a) for( int i=(b),_a=(a);i>=_a;i--)
#define REP(i,n) FOR(i,0,(n)-1)
#define DEP(i,n) DOW(i,(n)-1,0)
#define all(a) (a).begin() , (a).end()
#define push(a,b) (a).push_back((b))

typedef vector<int> VI ;
typedef vector<string> VS ;
template<class T> inline int size(const T&c) { return c.size(); }

using namespace std;
long long n;
const double eps =0.1;
const double seps=0.0000001;
long long res;
int l;
void calc(int x,long long y,long long z)
{
    long long a,b,c;
    b=(x+y)-z;
    c=(y+z)-x;
    a=(z+x)-y;
    if (a>0&&b>0&&c>0)
    {
        if (a==b&&a==c) res++;
        else
        if (a==b||a==c||c==b) res+=3;
        else
        res+=6;
    //cout<<' '<<x<<' '<<y<<' '<<z<<' '<<a<<' '<<b<<' '<<c<<endl;
    }
}
int main()
{
    freopen("C292.inp","r",stdin);
    //freopen("C292.out","w",stdout);
    cin>>n;
    res=0;
    if (n%3!=0)
    {
        cout<<"0";
    }
    else
    {
        n/=3;
        int gh1=pow(n+eps,(double)1/3);
        double gh2=pow(4*n+eps,(double)1/3);
        FOR(x,1,gh1)
        {
            if (n%x!=0) continue;
            //if (abs(gh2-(int)(gh2+seps))<=seps)l=gh2-x;else l=gh2-x+1;
            int l=max(x,(int)gh2-x);
            long long n2=n/x;
            long long r=sqrt(n2+eps);
            for(long long y=l;y<=r;y++)
            {
                if (n2%y!=0) continue;
                long long z=n2/y;
                if (x<=y&&y<=z&&(x+y+z)%2==0) calc(x,y,z);
            }
        }
        cout<<res<<endl;
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:128000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const long double PI = 3.14159265358979323846;
const long double gammama = 0.57721566490153286060;
const long double eps = 1e-5;
const int INF = 1000 * 1000 * 10 + 10;
const int N = 1000 * 10000 + 10;

int main() {
	//ios_base::sync_with_stdio(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n;
	cin >> n;
	if (n % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}
	n /= 3;
	int up = sqrt((double)n) + 3;
	vector<ll> d;
	for (int i = 1; i < up; ++i) {
		if (n % i == 0)
			d.push_back(i);
	}
	//cout << d.size() << endl;
	ll res = 0;
	for (int i = 0; i < d.size(); ++i) {
		for (int j = 0; j < i; ++j) {
			ll d1 = d[i];
			ll d2 = d[j];
			ll d3 = n / d1 / d2;
			if (d1 * d2 * d3 == n) {
				if ((d3 < d2) && (d2 + d3 >= d1) && ((d1 + d2 + d3) % 2 == 0))
					res += 6;
			}
		}
		ll d1 = d[i];
		ll d2 = d[i];
		ll d3 = n / d1 / d2;
		if ((d1 * d2 * d3 == n) && (d3 <= d1) && ((d1 + d2 + d3) % 2 == 0)) {
			if (d3 == d1)
				++res;
			else
				res += 2;
		}
	}
	cout << res << endl;

	return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

// m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if (  (apb+bpc<cpa) || (bpc+cpa<apb) || (cpa+apb<bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <iomanip>

#define REP(i,n) for(int i=0;i<n;i++)
#define ll long long

using namespace std;
//clock_t start, stop;

ll n;

ll maX(ll x, ll y)
{
	if(x>y)
		return x;
	else return y;
}

int main()
{
	//start = clock();

 /* Your code */

	cin>>n;
	//n = 93163582512000;
	//cout << n%3;
	if(n%3!=0) cout<<0<<endl;

	else
	{
		ll m=n/3;
		ll a,b,c,ub;
		ll x,y,z;

		ll j=0;
		ll res=0;

		while(j*j*j<=m) j++;

		//cout<<"geldim"<<endl;

		for(a=j-1; a>1;a--)
		{
			if(m%a==0)
			{
					//ub=1;
					ub= (ll)sqrt(m/a);

					for(b=ub;b>=maX((ub-a),a);b--)
					{
						if(m%(a*b)==0)
						{
								c=m/(a*b);

								if( ( (a+b+c) % 2 ) !=0 ) continue;
								else
								{
									ll sum=(a+b+c)/2;
									x=sum-a;
									y=sum-b;
									z=sum-c;

									if(x<=0||y<=0||z<=0) continue;

									if(x==y&&y==z&&x==z)
										res++;

									else if(x==z)
										res+=3;

									else if(y==z)
										res+=3;

									else if (x==z)
										res+=3;

									else res+=6;

									//cout<<x<<y<<z<<endl;
								}

						}
					}
			}

		}

		cout<<res<<endl;
	}

	//stop = clock();

	//printf("Run time: %g",(stop-start)/(double)CLOCKS_PER_SEC);

	//system("PAUSE");

	return 0;
}

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
//#include <ctime>
#include <map>
using namespace std;

long long cube(long long x){return x*x*x;}
long long f(long long x, long long y, long long z)
{
	return 3*((x+y+z)*(x*y+y*z+z*x)-x*y*z);
}
double cubeDouble(double x){return x*x*x;}
double fDouble(double x, double y, double z)
{return (cubeDouble(x+y+z)-cubeDouble(x)-cubeDouble(y)-cubeDouble(z));}

long long n;

long long binarySearchA()
{
	double L = 1, R = 1e7, M;
	while(R-L > 1)
	{
		M = (L + R) / 2;
		if(fDouble(M, M, M) > n + 1e-7)
			R = M;
		else
			L = M;
	}
	return (long long)(R+1e-7);
}

long long binarySearchB(long long a)
{
	double L = 1, R = 1e7, M;
	while(R-L > 1)
	{
		M = (L + R) / 2;
		if(fDouble(a, M, M) > n + 1e-7)
			R = M;
		else
			L = M;
	}
	return (long long)(R+1e-7);
}

double tail[1000001];
vector <int> factors;

int MAIN()
{
	while(cin >> n)
	{
		factors.clear();
		if(n % 3 != 0)
		{
			cout << 0 << endl;
			break;
		}
		for(long long i = 1;  i*i<= n/3; i++)
			if((n/3) % i == 0)
			{
				factors.push_back(i);
				if(i*i < (n/3))
					factors.push_back((n/3)/i);
			}
		sort(factors.begin(), factors.end());

		long long aLimit = binarySearchA();
		long long ans = 0;
		for(int i = 1; i <= aLimit; i++)
		{
			long long bLimit = binarySearchB(i);
			for(int J = 0; J < factors.size(); J++)
			{
				int j = factors[J] - i;
				if(j > bLimit) break;
				if(j < i) continue;

				double a = i, b = j;
				double A = a+b;
				double B = 2*a*b+a*a+b*b;
				double C = a*a*b+a*b*b - n/3.0;

				double delta = B*B-4*A*C;
				double c = (-B + sqrt(delta)) / (2*A);

				int k = int(c+1e-7);
				if(k < j)
					continue;

				if(f(i, j, k) == n)
				{
					//cout << i << " " << j << " " << k << endl;
					if(i == j && j == k)
						ans += 1;
					else if(i==j || j==k || i==k)
						ans += 3;
					else
						ans += 6;
					cout << i << " " << j << " " << k << endl;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

int main()
{
	//srand((unsigned)time(NULL));
	#ifdef LOCAL_TEST
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	ios :: sync_with_stdio(false);
	cout << fixed << setprecision(16);
	return MAIN();
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0 || n<=20) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

//  m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<=n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if ( (apb+bpc<=cpa) || (bpc+cpa<=apb) || (cpa+apb<=bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;
             a=(apb+bpc-cpa)/2;
             b=apb-a;
             c=bpc-b;

             apb=a; bpc=b; cpa=c;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=3; else
            if (apb!=bpc && bpc==cpa) ans+=3; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <ctime>
#include <numeric>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <complex>
#include <deque>
#include <functional>
#include <list>
#include <map>
#include <string>
#include <sstream>
#include <set>
#include <stack>
#include <queue>
using namespace std;
template<class T> inline T sqr(T x) { return x * x; }
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<PII, int> PIII;
typedef pair<LL, LL> PLL;
typedef pair<LL, int> PLI;
typedef pair<LD, LD> PDD;
#define MP make_pair
#define PB push_back
#define sz(x) ((int)(x).size())
#define clr(ar,val) memset(ar, val, sizeof(ar))
#define istr stringstream
#define FOR(i,n) for(int i=0;i<(n);++i)
const double EPS = 1e-6;
const int INF = 0x3fffffff;
const LL LINF = INF * 1ll * INF;
const double PI = acos(-1.0);

using namespace std;

LL ans = 0;
vector<LL> v;

void find(int id,LL x,LL y){
    for(int i = id;i<v.size();i++){
        if(y%v[i]==0){
            LL z = y/v[i];
            LL w = v[i];
            if((w+z-x)%2!=0) continue;
            LL c = (w+z-x)/2;
            LL b = w-c;
            LL a = x-b;
            if(a>0&&b>0&&c>0) ans++;
            if(z==w) continue;
            z = v[i];
            w = y/v[i];
            if((w+z-x)%2!=0) continue;
            c = (w+z-x)/2;
            b = w-c;
            a = x-b;
            if(a>0&&b>0&&c>0) ans++;
        }
    }
}

int main(void){
      //freopen("","r",stdin);
      LL n;
      cin>>n;
      if(n%3!=0){
          cout<<0<<endl;
          return 0;
      }
      n/=3;
      LL sq_n = sqrt(n+0.5);
      for(LL i = 2;i*i<=n;i++){
          if(n%i==0) v.PB(i);
      }
      for(int i = 0;i<v.size();i++)
          find(i,v[i],n/v[i]);
      cout<<ans<<endl;
}

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define SIZE(v) ((int)(v).size())

#define BEGIN(v) ((v).begin())
#define END(v) ((v).end())
#define ALL(v) BEGIN(v),END(v)
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) SORT(v);(v).erase(unique(ALL(v)),END(v))

#define FOR(i,l,r) for(int i=(l);i<(r);i++)
#define FOREACH(i,v) for(typeof((v).begin()) i=(v).begin();i!=(v).end();i++)

vector <bool> tagPrime;
vector <int> prime;

void initPrime(int n) {
	tagPrime = vector <bool> (n + 1);
	tagPrime[0] = tagPrime[1] = true;
	prime.clear();
	for (int i = 2; i <= n; i++) {
		if (tagPrime[i]) continue;
		prime.push_back(i);
		if (i > n / i) continue;
		for (int j = i * i; j <= n; j += i) {
			tagPrime[j] = true;
		}
	}
}

long long n, res;
vector<long long> primeFactor;
vector<int> cnt;

void dfs(int depth, long long x, long long y) {
	if (depth == SIZE(cnt)) {
		long long z = n / x / y;
		res += x + y > z && x + z > y && y + z > x;
		return ;
	}
	vector<long long> pow(cnt[depth] + 1);
	pow[0] = 1;
	FOR(i, 0, cnt[depth]) pow[i + 1] = pow[i] * primeFactor[depth];
	if (primeFactor[depth] == 2) {
		dfs(depth + 1, x * pow[cnt[depth]], y);
		dfs(depth + 1, x, y * pow[cnt[depth]]);
		dfs(depth + 1, x, y);
		if (cnt[depth] < 3) return ;
		x <<= 1;
		y <<= 1;
		cnt[depth] -= 3;
	}
	FOR(i, 0, cnt[depth] + 1) {
		FOR(j, 0, cnt[depth] - i + 1) {
			dfs(depth + 1, x * pow[i], y * pow[j]);
		}
	}
}

int main() {
	initPrime(10000000);
	cin >> n;
	if (n % 3) {
		cout << 0 << endl;
	} else {
		n /= 3;
		long long tmp = n;
		FOREACH(it, prime) {
			if (*it > tmp / *it) break;
			primeFactor.push_back(*it);
			cnt.push_back(1);
			for (tmp /= *it; !(tmp % *it); tmp /= *it, cnt.back()++) ;
		}
		if (tmp > 1) {
			primeFactor.push_back(tmp);
			cnt.push_back(1);
		}
		if (primeFactor.front() == 2) {
			dfs(0, 1, 1);
		}
		cout << res << endl;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);

void solv()
{
    long long n;
    cin >> n;
    if (n % 3 != 0)
    {
        cout << 0 << endl;
        return;
    }
    n /= 3;
    vector<long long> v;
    for (long long i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            v.push_back(i);
            if (i * i != n)
                v.push_back(n / i);
        }
    }
    sort(v.begin(), v.end());
    int ans = 0;
    long double nn = n;
    for (int i = 0; i < v.size(); ++i)
    {
        long long x = v[i];
        /*if (0.9 > nn / x / x / x)
        {
            break;
        }*/
        for (int j = i; j < v.size(); ++j)
        {
            long long y = v[j];
            /*if (0.9 > nn / x / y / y)
            {
                break;
            }*/
            long long z = n / x;
            if (z % y != 0)
                continue;
            z /= y;
            if (y > z)
                continue;
            long long c = x + y - z;
            if (c % 2 != 0)
                continue;
            c /= 2;
            long long a = x - c;
            long long b = y - c;
            if (a > 0 && b > 0 && c > 0)
            {
                if (a == b && b == c)
                    ++ans;
                else if (a == b || b == c || a == c)
                    ans += 2;
                else
                    ans += 6;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}

#include<bits/stdc++.h>
#define LL long long

using namespace std;

LL n;
LL d[612345];

LL fd1() {
    if(n % 24 == 0) {
        LL m = n / 24;
        LL p = 1;
        while(p * p * p <= m) {
            if(p * p * p == m) return 1;
            ++p;
        }
    }
    return 0;
}

LL fd2() {
    LL ret = 0;
    LL m = n / 6;
    LL lim2 = sqrt(m), lim3 = 1;
    while(lim3*lim3*lim3 <= m) lim3++; lim3--;
    for(LL i = max((LL)1, lim3 - 10); i <= lim2; ++i) {
        if(m % (i * i) == 0 && m / i / i < i && m / i / i * 2 != i)
            ret++;
    }
    return ret * 3;
}

LL fd3() {
    LL ret = 0;
    LL m = n / 3;
    int p = 0;
    LL q = sqrt(m);
    LL lim3 = 1;
    while(lim3*lim3*lim3 <= m) lim3++; lim3--;
    for(LL i = 2; i <= q; ++i) {
        if(m % i == 0) {
            d[++p] = i;
            if(i < m / i)
                d[++p] = m / i;
        }
    }
    sort(d + 1, d + p + 1);
    for(int i = 1; i <= p; ++i) {
        if(d[i] > lim3 + 10) break;
        for(int j = i + 1; j <= p; ++j) {
            if(m / d[i] % d[j] == 0 && m / d[i] / d[j] > d[j]) {
                LL a = d[i] + d[j] - m / d[i] / d[j];
                LL b = d[i] + m / d[i] / d[j] - d[j];
                LL c = d[j] + m / d[i] / d[j] - d[i];
                if(a > 0 && b > 0 && c > 0 && a % 2 == 0 && b % 2 == 0 && c % 2 == 0)
                    ret++;
            }
            else if(m / d[i] / d[j] < d[j]) break;
        }
    }
    return ret * 6;
}

void op_ar(LL *ar, int num) {
    for(int i = 1; i <= num; ++i) {
        printf("%lld", ar[i]);
        if(i == num) printf("\n");
        else printf(" ");
    }
}

int main() {
    scanf("%lld", &n);
    LL ans = 0;
    ans += fd1();
    //printf("%lld\n", ans);
    ans += fd2();
    //printf("%lld\n", ans);
    ans += fd3();
    printf("%lld\n", ans);
    return 0;
}

#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <cmath>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-7
#define maxm 200000000
#define MAXN 33
#define inf 1000000000
//const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi 3.1415926535
using namespace std;
__int64 a[1000000];
int l;
void get(__int64 n)
{
      __int64 k=(__int64)sqrt((double)n);
      __int64 i;
      l=0;
      for (i=2;i<=k;i++)
      {
          if (n%i==0)
          {
              a[l++]=i;
          }
      }
}
int main()
{
    //freopen("E:\\in.txt","r",stdin);
    //freopen("E:\\out.txt","w",stdout);
    __int64 n;
   while(scanf("%I64d",&n)!=EOF)
   {
    if (n%3)
    {
        printf("0\n");
        continue;
    }
    n/=3;
    get(n);
    //printf("%d\n",l);
    __int64 x,y,z;
     int i,j;
     int ans=0;
     for (i=0;i<l;i++)
     {
         for (j=i;j<l;j++)
         {
            x=a[i];
            y=a[j];
            z=n/x;
            if(z%a[j]) continue;
            z/=a[j];
            if(z<y) break;
            if((x+y-z)<0||(x+y-z)%2==1) continue;
            if((x+z-y)<0||(x+z-y)%2==1) continue;
            if((z+y-x)<0||(y+z-x)%2==1) continue;
            if(a[i]==a[j]&&a[i]==z)
            ans++;
            else if(x==y||x==z||y==z)
            {
                 ans+=3;
            }
            else ans+=6;
         }
     }
     printf("%d\n",ans);
   }
    return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0 || n<=20) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

//  m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<=n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if ( (apb+bpc<=cpa) || (bpc+cpa<=apb) || (cpa+apb<=bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;
             a=(apb+bpc-cpa)/2;
             b=apb-a;
             c=bpc-b;

             apb=a; bpc=b; cpa=c;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

// c.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <cmath>

#pragma comment(linker, "/STACK:167772160")

using namespace std;

bool sqr(long long x){
        long double y=sqrt((long double)x);
        return abs(ceil(y)-y)<1e-6;
    }

int main()
{
    long long n;
    cin>>n;
    long long div[10000000];
    int k=0;
    if(n%3!=0){
            cout<<0;
            return 0;
        }
        n/=3;
        for(long long i=2;i*i<=n;i++){
            if(n%i==0){
                div[k++]=i;
                if(n/i!=i)
                    div[k++]=n/i;
            }
        }
        long long ans=0;
        for(int i=0;i<k;i++){
            long long x=div[i];
            long long m=n/x;
            for(long long b=1;b<x;b++){
                long long c=x-b;
                long long y=b*c-m;
                if(y>=0||b>c)break;
                long long d=x*x-4*y;
                if(d<0)break;
                if(!sqr(d))continue;
                long long a=(-x+(long long )sqrt((long double)d))/2;
                if(a>b||a<=0)continue;
                if(a==b&&b==c){
                    ans++;
                }
                else
                    if(a==b||a==c||b==c){
                        ans+=3;
                    }
                else
                        ans+=6;
            }
        }
        cout<<ans;
    return 0;
}

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

vector<long long> enum_divisors(long long n) {
    vector<long long> res;
    for (long long i = 1LL; i * i <= n; i++) {
        if (n % i != 0) continue;
        res.emplace_back(i);
        // if (i != n / i) res.emplace_back(n / i);
    }
    // sort(res.begin(), res.end());
    return res;
}

int main() {
    long long n; cin >> n;
    if (n % 3) return !(cout << 0 << endl);
    n /= 3;
    auto ds = enum_divisors(n);
    long long cnt = 0;
    for (long long x: ds) for (long long y: ds) if (x <= y) {
        if (n / x % y) continue;
        long long z = n / x / y;
        if (y > z) continue;
        long long s = x + y + z;
        if (s % 2) continue;
        s /= 2;
        long long a = s - y, b = s - z, c = s - x;
        if (a <= 0 || b <= 0 || c <= 0) continue;
             if (a == b && b == c) cnt += 1;
        else if (a == b || b == c) cnt += 3;
        else                       cnt += 6;
    }
    cout << cnt << endl;
    return 0;
}

#include <cstdio>
#include <numeric>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
#include <deque>

using namespace std;

#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); i++)
#define re return
#define fi first
#define se second
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#define y0 y3487465
#define y1 y8687969
#define fill(x,y) memset(x,y,sizeof(x))

typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef double D;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<vi> vvi;

template<class T> T abs(T x) { re x > 0 ? x : -x; }

ll n;
ll q[1000000];

int main () {
    cin >> n;
    if (n % 3 != 0) {
        printf ("0\n");
        re 0;
    }
    n /= 3;
    int o = 0;
    for (int x = 2; (ll)x * x <= n; x++)
        if (n % x == 0) {
            q[o++] = x;
            if (x != n / x)
                q[o++] = n / x;
        }
    sort (q, q + o);
    int ans = 0;
    for (int i = 0; i < o && (ll)q[i] * q[i] * q[i] <= n; i++) {
        int ab = q[i];
        ll nn = n / ab;
        for (int j = i; j < o && (ll)q[j] * q[j] <= nn; j++)
            if (nn % q[j] == 0) {
                int ac = q[j];
                int bc = nn / ac;
                if ((ab + ac + bc) % 2 == 0) {
                    int a = (ab + ac - bc) / 2;
                    int b = (ab + bc - ac) / 2;
                    int c = (ac + bc - ab) / 2;
                    if (a > 0 && b > 0 && c > 0 && a <= b && b <= c) {
                        if (a == b && b == c) ans++; else
                        if (a == b || b == c) ans += 2; else ans += 6;
                    }
                }
            }
    }
    cout << ans << endl;
//  cerr << clock () << endl;
    return 0;
}

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <cassert>
#include <iostream>

using namespace std;

const double eps = 1e-9;
const int inf = 1e9 + 23;

const int size = 1000 * 300;
const long long BIG = 1000 * 1000 * 100;

long long divis[size];

int main (void){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	long long n, a, b, c;
	int ans = 0, k = 0;
	long long aa, bb, cc, d;

	cin >> n;
	if (n % 3 != 0 || n < 6){
		printf("0\n");
		return 0;
	}
	n /= 3;
	long long i;
	for (i = 1; i * i < n; i++)
		if (n % i == 0){
			divis[k++] = i;
			divis[k++] = n / i;
		}
	if (i * i == n)
		divis[k++] = i;
	sort(divis, divis + k);
	int last = 0;
	for (a = 1; 2 * (a * a + a + 1) <= n; a++){
		for (; divis[last] < a + 1 && last < k; last++);
		if (last == k)
			break;
		for (int j = last; j < k; j++){
		//for (b = 1; b <= a && (1 + a) * (b * (1 + a) + b * b + a) <= n; b++){
			b = divis[j] - a;
			if (b > a || (1 + a) * (b * (1 + a) + b * b + a) > n)
				break;
			//if (a > BIG || b > BIG){
			//	printf("Op\n");
			//	return 0;
			//}
			//if (b % 30000 == 0 || a % 30000 == 0)
				//fprintf(stderr, "%I64d %I64d\n", a , b);
			//if (n % (a + b) != 0)
			//	continue;
			//aa = a + b;
			//bb = a + b;//b * b + a * a + 2 * a * b;
			//cc = a * b - n / (a + b);//a * a * b + b * b * a - n;
			//if (n / (a + b) != divis[k - j - 1])
			//	printf("No!!!\n");
			d = (a - b) * (a - b) + divis[k - j - 1] * 4;//n / (a + b) * 4;
			aa = sqrt(d);
			if (aa * aa != d)
				continue;
			//if ((aa - a - b)  % 2 == 0){
				bb = (aa - a - b) / 2;
				if (bb > b)
					continue;
				if (a == b){
					if (b == bb)
						ans += 1;
					else
						ans += 3;
				}
				else{
					if (b == bb)
						ans += 3;
					else
						ans += 6;
				}
			//}
			//printf("%d\n", ans);
		}
	}
	cout << ans << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define int long long int
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB emplace_back
#define endl "\n"
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
const int N = 1005000;

int power(int x,int y,int m=mod){int res=1;x=x%m;while(y>0){if(y&1)res=(res*x)%m;y=y>>1;x=(x*x)%m;}return res;}
int ncr(int n,int r){if(n<r)return 0;int p=1,k=1;if(n-r<r)r=n-r;if(r!=0){while(r){p*=n;k*=r;int g=__gcd(p, k);p/=g;k/=g;n--;r--;}}else p=1;return p;}
//cout<<fixed<<setprecision(8)<<x<<endl;

signed main()
{
	fast;
    //int t=1; cin>>t; while(t--)
    {
    	int n;
    	cin>>n;

    	if(n%3)
    		return cout<<"No\n",0;

    	n/=3;
    	vector<int> v;
    	for(int i=2;i*i<=n;i++)
    	{
    		if(n%i==0)
    		{
    			v.PB(i);
    			if(i!=n/i)
    				v.PB(n/i);
    		}
    	}

    	int ans=0;
    	sort(v.begin(),v.end());
    	int nv=v.size();

    	for(int i=0;i<nv;i++)
    	{
    		for(int j=i;j<nv && v[i]*v[j]<=n;j++)
    		{
    			int a=v[i];
    			int b=v[j];
    			int c=n/(a*b);

    			if(c<b || (a+b-c)%2 || a+b<=c || n%(a*b))
    				continue;

    			int ac=(a+b-c)/2;
    			int bc=a-ac;
    			int cc=b-ac;

    			//cout<<a<<" "<<b<<" "<<c<<endl;
    			//cout<<i<<" "<<j<<" "<<ac<<" "<<bc<<" "<<cc<<endl;
    			if(ac==bc && bc==cc)
    				ans+=1;
    			else if(ac==bc || bc==cc)
    				ans+=3;
    			else
    				ans+=6;

    		}
    	}

    	cout<<ans<<endl;

    }
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#define f first
#define s second
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define vi vector <int>
#define ld long double
#define pii pair<int, int>
using namespace std;
const int N = int(1e7);
int p[N/10],pn;
ll n;
bool u[N+10];
int c[40],d[40],cn,d2[40];
int ans;
ll val2;
ll A,B,C,s;

void rec2(int x,ll val,ll val1){
    if(x == cn + 1){
    	val2 = n / (val * val1);
        if(val > 1 && val2 > 1){
        	s = (val + val1 + val2);
        	if(s % 2 == 0) {
        		s /= 2;
        		if(s > val && s > val1 && s > val2) ans++;
        	}
        }
    	return;
    }
    for(int i=0;i<=d2[x];i++){
    	rec2(x+1,val,val1);
    	val *= p[x];
    }
}

void rec(int x,ll val){
	if(x == cn + 1){
		if(val > 1) rec2(1,1,val);
		return;
	}
	for(int i=0;i<=d[x];i++){
		d2[x] = d[x] - i;
		rec(x+1,val);
		val *= p[x];
	}
}

void tup(){
	for(int a=1;a<=n;a++){
		for(int b=1;b<=n;b++){
			for(int c=1;c<=n;c++){
				if((a+b)*(b+c)*(c+a) == n){
					cerr << a << " " << b << " " << c << endl;
				}
			}
		}
	}
}

int main () {
	for(int i=4;i<=N;i+=2) u[i] = 1;
	int K = int(sqrt(N+2.0));
	for(int i=3;i<=K;i+=2) if(!u[i]){
		for(int j=i*i;j<=N;j+=(i+i)) u[j] = 1;
	}
	for(int i=2;i<=N;i++) {
		if(!u[i]) p[++pn] = i;
	}
	cin >> n;
	if(n % 3){
		cout << 0;
		return 0;
	}
	n /= 3;
	ll cur = n;
	for(int i=1;i<=pn;i++){
		if(n % p[i] == 0){
			c[++cn] = p[i];
			while(n % p[i] == 0){
				n /= p[i];
				d[cn]++;
			}
		}
	}
	if(n > 1){
		c[++cn] = n;
		d[cn] = 1;
	}
	n = cur;
	rec(1,1);
	cout << ans;

return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

int get(long long a,long long b,long long c,long long n)
{
	long long t=a+b+c;
	n*=3;
	if(t*t*t-n-a*a*a-b*b*b-c*c*c)
		return 0;
	if(a==b&&b==c)
		return 1;
	if(a==b||b==c||a==c)
		return 3;
	return 6;
}
int isgen(long long n)
{
	long long ans=sqrt(n+0.0);
	if(ans*ans==n)
		return ans;
	//ans++;
	//if(ans*ans==n)
	//	return ans;
	//ans-=2;
	//if(ans*ans==n)
	//	return ans;
	return 0;
}
int main()
{
	long long n;
	long long ans=0;

	long long i,j;
	cin>>n;
	n/=3;
	long long k;
	long long ii;
	for(ii=1;ii*ii*ii*2<=n;ii++);
	for(k=2;k<=ii+ii;k++)if(n%k==0)
	{
		long long tt=n/k,t;
		for(i=1;i+i<=k&&i*i*i*8<=n;i++)
		{
			j=k-i;
			if(j*j*j*2>n)
				continue;
			t=tt;
			t-=i*j;
			long long ca;
			ca=isgen(k*k+4*t);
			if(ca&&(ca-k)%2==0&&(j<<1)<=(ca-k))
				ans+=get(i,j,(ca-k)/2,n);
		}
	}
	cout<<ans<<endl;
}

#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <cmath>
#include <string.h>
#include <iterator>
#include <cstdlib>
#include<stack>
#include<map>
#include<set>
#define inff 0x1f
#define EPS 1e-7
#define maxm 200000000
#define MAXN 33
#define inf 1000000000
//const long long INF =1000000000;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
#define N  100002
#define mod 1000000007
//#define pi acos(-1.0)
#define pi 3.1415926535
using namespace std;
__int64 a[1000000];
int l;
void get(__int64 n)
{
      __int64 k=(__int64)sqrt((double)n);
      __int64 i;
      l=0;
      for (i=2;i<=k;i++)
      {
          if (n%i==0)
          {
              a[l++]=i;
          }
      }
}
int main()
{
    //freopen("E:\\in.txt","r",stdin);
    //freopen("E:\\out.txt","w",stdout);
    __int64 n;
   while(scanf("%I64d",&n)!=EOF)
   {
    if (n%3)
    {
        printf("0\n");
        continue;
    }
    n/=3;
    get(n);
    //printf("%d\n",l);
    __int64 x,y,z;
     int i,j;
     int ans=0;
     for (i=0;i<l;i++)
     {
         for (j=0;j<l;j++)
         {
            x=a[i];
            y=a[j];
            z=n/x;
            if(z%a[j]) continue;
            z/=a[j];
            if((x+y-z)<0||(x+y-z)%2==1) continue;
            if((x+z-y)<0||(x+z-y)%2==1) continue;
            if((z+y-x)<0||(y+z-x)%2==1) continue;
            ans++;
         }
     }
     printf("%d\n",ans);
   }
    return 0;
}

#include <cstdio>
#include <algorithm>

const int MAXN = 1e7+10;

using namespace std;

long long N;
long long factor[MAXN];
int si;

int main()
{
	scanf("%I64d",&N);
	long long A = N/3;
	if(A*3 != N)
	{
		printf("0\n");
		return 0;
	}
	for(long long c = 2 ; c*c <= A ; c++)
	{
		long long a = A/c;
		if(a*c == A)
			factor[si++] = c;
	}
	// printf("%d\n", si);
	long long sol = 0;
	for(int c = 0 ; c < si ; c++)
	{
		long long a = factor[c];
		long long b = A/a;
		for(int d = c ; d < si ; d++)
		{
			long long x = b/factor[d];
			if(a <= factor[d] and factor[d] <= x and x*factor[d] == b and ((a+factor[d]+x)&1) == 0)
			{
				// a,factor[d],x
				// printf("%lld %lld %lld\n", a,factor[d],x);
				if(a+factor[d] > x)
				{
					if(a == factor[d] and factor[d] == x)
						sol++;
					else if(a == factor[d] or factor[d] == x or a == x)
						sol += 3;
					else
						sol += 6;
				}
			}
		}
	}
	printf("%I64\n", sol);
}

#include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>

#include <ctime>
#include <deque>
#include <bitset>
#include <cctype>
#include <utility>
#include <cassert>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)
#define Fit(i,v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define Fitd(i,v) for(__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))

template<class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T r; ss >> r; return r; }
template<class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sqr(T x) { return x * x; }
template<class T> T cube(T x) { return x * x * x; }
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return s == 0 ? 0 : cntbit(s >> 1) + (s & 1); }
const int bfsz = 1 << 16; char bf[bfsz + 5]; int rsz = 0;int ptr = 0;
char gc() { if (rsz <= 0) { ptr = 0; rsz = (int) fread(bf, 1, bfsz, stdin); if (rsz <= 0) return EOF; } --rsz; return bf[ptr++]; }
void ga(char &c) { c = EOF; while (!isalpha(c)) c = gc(); }
int gs(char s[]) { int l = 0; char c = gc(); while (isspace(c)) c = gc(); while (c != EOF && !isspace(c)) { s[l++] = c; c = gc(); } s[l] = '\0'; return l; }
template<class T> bool gi(T &v) {
    v = 0; char c = gc(); while (c != EOF && c != '-' && !isdigit(c)) c = gc(); if (c == EOF) return false; bool neg = c == '-'; if (neg) c = gc();
    while (isdigit(c)) { v = v * 10 + c - '0'; c = gc(); } if (neg) v = -v; return true;
}

#define maxn 2000005
#define mod 1000000007

ll n;
vector<ll> V;
ll a, b, c;

int calcu(){
    if(c > a) return 0;
    if((a + b + c) * (a + b + c) * (a + b + c) - a * a * a - b * b * b - c * c * c != n) {
        return 0;
    }
    if(a == b && a == c) return 1;
    if(a == b) return 1;
    if(a == c) return 2;
    return 3;
}

int main(){
//  freopen("in.txt", "r", stdin);

    cin >> n;
    if(n % 3){
        cout << 0;
        return 0;
    }
    ll N = n / 3 * 4;

    for(int i = 2; i * 1ll * i <= N; i++) if(N % i == 0){
        if(i * 1ll * i == N) V.pb(i);
        else {
            V.pb(i); V.pb(N / i);
        }
    }

    sort(all(V));
    int run = 0;
    ll res = 0;
    for(a = 1; a * a * 6 <= n; a++){
        if(24 * a * a < n / a) continue;
        while(V[run] <= a) run++;
        for(int u = run;;u++){
            b = V[u] - a;
            if(b > a || 3 * a * a > n / b) break;
            ll d = (a - b) * (a - b) + N / (a + b);
            ll x = (ll)sqrt(d + 0.5);
            if(x * x != d) continue;
            if((x - a - b) > 0 && (x - a - b) % 2 == 0){
                c = (x - a - b) / 2;
            }
            res += calcu();
        }
    }
    cout << res;

    return 0;
}

#include <cstdio>
#include <vector>
using namespace std;
long long N;
vector<long long>A;
bool check(long long a,long long b,long long c) {
    if(a+b<=c||a+c<=b||b+c<=a) return 0;
    if((a+b-c)%2==1||(b+c-a)%2==1||(a+c-b)%2==1) return 0;
    return 1;
}
int main()
{
    scanf("%I64d",&N);
    if(N%3!=0) {puts("0");getchar();getchar();return 0;}
    for(long long i=2;(long long)i*(long long)i<=N;i++) if(N%i==0)A.push_back(i);
    N/=3;
    int ret=0;
    for(int i=0;i<A.size();i++) {
        N/=A[i];
        for(int j=0;j<A.size();j++) if(N%A[j]==0)
            if(check(A[i],A[j],N/A[j]))ret++;
        N*=A[i];
    }
    printf("%d\n",ret);
    getchar();getchar();
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<map>
using namespace std;
typedef long long lld;
#define pb push_back
#define mp make_pair
#define X first
#define Y second
void change(lld &a,lld &b,lld &c)
{
    if(a > b)
        swap(a,b);
    if(a > c)
        swap(a,c);
    if(b > c)
        swap(b,c);
}
bool isprime[10000010];
lld prime[1000010];
int total;
vector<pair<lld,int> >fac;
lld s[110][110];
lld add[110];
int T;
lld ans;
set<pair<pair<int,lld>,pair<lld,lld> > >ooxx;
void dfs(int dep,lld a,lld b,lld c)
{
    if(ooxx.find(mp(mp(dep,a),mp(b,c))) != ooxx.end())
        return;
    ooxx.insert(mp(mp(dep,a),mp(b,c)));
//  printf("%d %I64d %I64d %I64d\n",dep,a,b,c);
    if(dep == T)
    {
        if((a+b+c)%2 == 1)
            return;
        if(a == b && b == c)
        {
            ans+=1;
            return;
        }
        if(a == b || b == c)
        {
            ans+=3;
            return;
        }
//      printf("%I64d %I64d %I64d\n",a,b,c);
        ans+=6;
        return;
    }
    int len=fac[dep].Y;
    s[dep][0]=1;
    for(int i=1;i<=len;i++)
        s[dep][i]=s[dep][i-1]*fac[dep].X;
    for(int i=0;i<=len;i++)
        for(int j=0;i+j<=len;j++)
        {
            int k=len-i-j;
            lld la=a*s[dep][i];
            lld lb=b*s[dep][j];
            lld lc=c*s[dep][k];
            change(la,lb,lc);
//          if(la+lb*add[dep+1] <= lc)
//              continue;
            dfs(dep+1,la,lb,lc);
        }
}
int main()
{
    total=0;
    memset(isprime,true,sizeof(isprime));
    for(int i=2;i<=10000000;i++)
        if(isprime[i])
        {
            prime[total++]=i;
            for(lld j=(lld)i*i;j<=10000000;j+=i)
                isprime[j]=false;
        }
    lld n;
    scanf("%I64d",&n);
    if(n%3 != 0)
    {
        printf("0\n");
        return 0;
    }
    n/=3;
    fac.clear();
    for(int i=0;i<total && prime[i]*prime[i] <= n;i++)
    {
        if(n%prime[i] == 0)
        {
            int T=0;
            while(n%prime[i] == 0)
            {
                n/=prime[i];
                T++;
            }
            fac.pb(mp(prime[i],T));
        }
    }
    if(n != 1)
        fac.pb(mp(n,1));
//  printf("%d\n",fac.size());
    ans=0;
    if(fac[0].X != 2)
    {
        printf("0\n");
        return 0;
    }
    T=fac.size();
    add[T]=1;
    for(int i=T-1;i>=0;i--)
    {
        add[i]=add[i+1];
        for(int j=0;j<fac[i].Y;j++)
            add[i]*=fac[i].X;
    }
    ooxx.clear();
    dfs(0,1,1,1);
    printf("%I64d\n",ans);
    return 0;
}

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) > (b)) ? (b) : (a))
#define abs(a) (((a) > 0) ? (a) : (-(a)))

using namespace std;

long long result = 0;

void check (long long a, long long b, long long c, long long n) {
	if (a <= 0) return;
	if (b <= 0) return;
	if (c <= 0) return;
	if (a > b)  return;
	if (b > c)  return;
	long long inc=0;
	if (a == b && b == c) inc = 1; else
		if (a == b || b == c) inc = 3; else
										inc = 6;
	if (a*a*a + b*b*b + c*c*c + n == (a+b+c)*(a+b+c)*(a+b+c)) result += inc;
}

int main () {
	long long n;
	cin >> n;
	n /= 3;
	for (long long x = 1; x*x*x <= n; x++)
		if (n%x == 0) {
			long long t = n/x;
			for (long long a = 1; a <= x/2; a++) {
				long long b = x-a;
				long long D = (a+b)*(a+b)-4*(a*b-t);
				if (D < 0) continue;
				long long q = (long long) sqrt(D);
				if (q*q != D) continue;
				if (D == 0) {
					long long c = (-(a+b))/2;
					check(a, b, c, n*3);
				}
				else {
					long long c = (-(a+b)+q)/2;
					check(a, b, c, n*3);
					c = (-(a+b)-q)/2;
					check(a, b, c, n*3);
				}
			}
		}
	cout << result;
}

#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#define int64 long long
#define For(i,x,y) for (i=x;i<=y;i++)
using namespace std;
int64 i,j,k,n,m,an;
inline int work(int a,int b,int c) {
	return a==b&&b==c?1:a==b||b==c?3:6;
}
int main() {
	scanf("%I64d",&n);
	if (n%3) {
		printf("0\n"); return 0;
	}
	n/=3;
	int A=(int)(pow(n,1./3)+1e-9);
	For(i,2,A) if (n%i==0) {
		int B=int(sqrt(n/i)+1e-9);
		for(j=B;j>=i;j--) if (n/i%j==0) {
			int C=n/i/j;
			if (i+j<C) break;
			if (j<=C&&(i+j+C)%2==0) {
				int D=(i+j+C)/2;
				an+=work(D-C,D-j,D-i);
			}
		}
	}
	printf("%I64d\n",an);
	//for(;;);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);

void solv()
{
    long long n;
    cin >> n;
    if (n % 3 != 0)
    {
        cout << 0 << endl;
        return;
    }
    n /= 3;
    vector<long long> v;
    for (long long i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            v.push_back(i);
            if (i * i != n)
                v.push_back(n / i);
        }
    }
    sort(v.begin(), v.end());
    int ans = 0;
    long double nn = n;
    for (int i = 0; i < v.size(); ++i)
    {
        long long x = v[i];
        if (1 > nn / x / x / x)
            break;
        for (int j = i; j < v.size(); ++j)
        {
            long long y = v[j];
            if (1 > nn / x / y / y)
                break;
            long long z = n / x;
            if (z % y != 0)
                continue;
            z /= y;
            long long c = x + y - z;
            if (c % 2 != 0)
                continue;
            c /= 2;
            long long a = x - c;
            long long b = y - c;
            if (a > 0 && b > 0 && c > 0)
            {
                if (a == b && b == c)
                    ++ans;
                else if (a == b || b == c || a == c)
                    ans += 2;
                else
                    ans += 6;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0 || n<=20) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

//  m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<=n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if ( (apb+bpc<=cpa) || (bpc+cpa<=apb) || (cpa+apb<=bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;
             a=(apb+bpc-cpa)/2;
             b=apb-a;
             c=bpc-b;

             apb=a; bpc=b; cpa=c;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=3; else
            if (apb!=bpc && bpc==cpa) ans+=3; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long LL;

int main(){
    LL n;
    cin >> n;
    if( n%3 != 0){
        cout<<0<<endl;
        return 0;
    }
    n /= 3;
    int ans = 0;
    for(LL i = 2; i*i*i <= n ; i ++ ){
        if( n%i ) continue;
        LL m = n/i;
        for(LL j = i; j*j  <= m; j ++){
            if( m%j ) continue;
            LL k=m/j;
            if(i <=j && j <= k && (i+j) > k){
                if(i==j && j==k) ans +=1;
                else{
                    if( (i+j-k)%2 || (i+k-j)%2 || (j+k-i)%2 ) continue;
                    else{
                        int a = (i+j-k)/2,b=(i+k-j)/2,c=(j+k-i)/2;
                        cout<<a<<" "<<b<<" "<<c<<endl;
                        if(a == b && b == c) ans+=1;
                        if(a < b && b < c) ans+=6;
                        if( a== b && b < c) ans +=3;
                        if( a < b && b ==c ) ans +=3;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}

#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <windows.h>
using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, int> pii;

ll n, del[111111], dels;
int cnt;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> n;
	if (n%3==0)
	{
		n /= 3;
		for (ll i=2; i*i<=n; i++)
			if (!(n%i))
				del[dels++] = i;
		for (int ix = 0; ix < dels && del[ix]*del[ix]*del[ix] <= n; ix++)
			for (int iy = ix; iy < dels && del[ix]*del[iy]*del[iy] <= n; iy++)
			{
				ll x = del[ix], y = del[iy];
				if (!(n%(x*y)))
				{
					ll z = n/(x*y);
					if (x+y-z > 0 && !((x+y-z)%2))
					{
						ll a = (x+y-z) >> 1;
						ll b = x-a;
						ll c = z-b;
						if (a==b)
						{
							if (b==c)
								cnt += 1;
							else
								cnt += 2;
						}else
						{
							if (b==c)
								cnt += 2;
							else
								cnt += 6;
						}
					}
				}
			}
	}
	cout << cnt << endl;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:128000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const long double PI = 3.14159265358979323846;
const long double gammama = 0.57721566490153286060;
const long double eps = 1e-5;
const int INF = 1000 * 1000 * 10 + 10;
const int N = 1000 * 10000 + 10;

int main() {
	//ios_base::sync_with_stdio(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n;
	cin >> n;
	if (n % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}
	n /= 3;
	int up = sqrt((double)n) + 3;
	vector<ll> d;
	for (int i = 1; i < up; ++i) {
		if (n % i == 0)
			d.push_back(i);
	}
	//cout << d.size() << endl;
	ll res = 0;
	for (int i = 0; i < d.size(); ++i) {
		for (int j = 0; j < i; ++j) {
			ll d1 = d[i];
			ll d2 = d[j];
			ll d3 = n / d1 / d2;
			if (d1 * d2 * d3 == n) {
				if ((d3 < d2) && (d2 + d3 >= d1) && ((d1 + d2 + d3) % 2 == 0))
					res += 6;
			}
		}
		ll d1 = d[i];
		ll d2 = d[i];
		ll d3 = n / d1 / d2;
		if ((d1 * d2 * d3 == n) && (d3 <= d1) && ((d1 + d2 + d3) % 2 == 0)) {
			if (d3 == d1)
				++res;
			else
				res += 2;
		}
	}
	cout << res << endl;

	return 0;
}

#include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>

#include <ctime>
#include <deque>
#include <bitset>
#include <cctype>
#include <utility>
#include <cassert>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)
#define Fit(i,v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define Fitd(i,v) for(__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))

template<class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T r; ss >> r; return r; }
template<class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sqr(T x) { return x * x; }
template<class T> T cube(T x) { return x * x * x; }
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return s == 0 ? 0 : cntbit(s >> 1) + (s & 1); }
const int bfsz = 1 << 16; char bf[bfsz + 5]; int rsz = 0;int ptr = 0;
char gc() { if (rsz <= 0) { ptr = 0; rsz = (int) fread(bf, 1, bfsz, stdin); if (rsz <= 0) return EOF; } --rsz; return bf[ptr++]; }
void ga(char &c) { c = EOF; while (!isalpha(c)) c = gc(); }
int gs(char s[]) { int l = 0; char c = gc(); while (isspace(c)) c = gc(); while (c != EOF && !isspace(c)) { s[l++] = c; c = gc(); } s[l] = '\0'; return l; }
template<class T> bool gi(T &v) {
    v = 0; char c = gc(); while (c != EOF && c != '-' && !isdigit(c)) c = gc(); if (c == EOF) return false; bool neg = c == '-'; if (neg) c = gc();
    while (isdigit(c)) { v = v * 10 + c - '0'; c = gc(); } if (neg) v = -v; return true;
}

#define maxn 2000005
#define mod 1000000007

ll n;
vector<ll> V;
ll a, b, c;

int calcu(){
    if(c > a) return 0;
    if((a + b + c) * (a + b + c) * (a + b + c) - a * a * a - b * b * b - c * c * c != n) return 0;
    if(a == b && a == c) return 1;
    if(a == b) return 1;
    if(a == c) return 2;
    return 3;
}

int main(){
//  freopen("in.txt", "r", stdin);

    cin >> n;
    if(n % 3){
        cout << 0;
        return 0;
    }
    ll N = n / 3 * 4;

    for(int i = 2; i * 1ll * i <= N; i++) if(N % i == 0){
        if(i * 1ll * i == N) V.pb(i);
        else V.pb(i); V.pb(N / i);
    }

    sort(all(V));
    int run = 0;
    ll res = 0;
    for(a = 1; a * a * 6 <= n; a++){
        if(24 * a * a * a < n) continue;
        while(V[run] <= a) run++;
        for(int u = run;;u++){
            b = V[u] - a;
            if(b > a || 3 * a * a * b > n) break;
            ll d = (a - b) * (a - b) + N / (a + b);
            ll x = (ll)sqrt(d + 0.5);
            if(x * x != d) continue;
            if((x - a - b) > 0 && (x - a - b) % 2 == 0){
                c = (x - a - b) / 2;
            }
            res += calcu();
        }
    }
    cout << res;

    return 0;
}

// c.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <cmath>

#pragma comment(linker, "/STACK:167772160")

using namespace std;

bool sqr(long long x){
        long double y=sqrt((long double)x);
        return abs(ceil(y)-y)<1e-6;
    }

int main()
{
    long long n;
    cin>>n;
    long long div[10000000];
    int k=0;
    if(n%3!=0){
            cout<<0;
            return 0;
        }
        n/=3;
        for(long long i=2;i*i<=n;i++){
            if(n%i==0){
                div[k++]=i;
                if(n/i!=i)
                    div[k++]=n/i;
            }
        }
        long long ans=0;
        for(int i=0;i<k;i++){
            long long x=div[i];
            long long m=n/x;
            for(long long b=1;b<x;b++){
                long long c=x-b;
                long long y=b*c-m;
                if(y>=0||b>c)break;
                long long d=x*x-4*y;
                if(d<0)break;
                if(!sqr(d))continue;
                long long a=(-x+(long long )sqrt((long double)d))/2;
                if(a>b||a<=0)continue;
                if(a==b&&b==c){
                    ans++;
                }
                else
                    if(a==b||a==c||b==c){
                        ans+=3;
                    }
                else
                        ans+=6;
            }
        }
        cout<<ans;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);

void solv()
{
    long long n;
    cin >> n;
    if (n % 3 != 0)
    {
        cout << 0 << endl;
        return;
    }
    n /= 3;
    vector<long long> v;
    for (long long i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            v.push_back(i);
            if (i * i != n)
                v.push_back(n / i);
        }
    }
    sort(v.begin(), v.end());
    int ans = 0;
    long double nn = n;
    for (int i = 0; i < v.size(); ++i)
    {
        long long x = v[i];
        if (1 > nn / x / x / x)
            continue;
        for (int j = i + 1; j < v.size(); ++j)
        {
            long long y = v[j];
            if (1 > n / x / y / y)
                continue;
            long long z = n / x;
            if (z % y != 0)
                continue;
            z /= y;
            long long c = x + y - z;
            if (c % 2 != 0)
                continue;
            c /= 2;
            long long a = x - c;
            long long b = y - c;
            if (a > 0 && b > 0 && c > 0)
            {
                if (a == b && b == c)
                    ++ans;
                else if (a == b || b == c || a == c)
                    ans += 2;
                else
                    ans += 6;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}

#pragma comment(linker, "/STACK:10000000")
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE

#include <cassert>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <numeric>
#include <bitset>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <functional>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long i64;
typedef unsigned long long u64;
typedef double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> T inline sqr(T x) {
    return x * x;
}
#define y1 AAA_BBB
#define y0 AAA_AAA

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(v) (int)((v).size())
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)

const ld pi = 3.1415926535897932384626433832795;
const ld eps = 1e-8;
i64 ans = 0;
bool  f(i64 x, i64 y, i64 n)
{
			i64 s = x + y;
			i64 ch = -n/(x*y) +x+y;
			i64 zn = 2;
			i64 w = ch / zn;
			if (ch == w * zn)
				if (1 <= w && w < x && w < y)
				{
					i64 k1 = x - w, k2 = y - w, k3 = w;
					if (k3 < k2)
						return true;
					if (k1 == k2)
					{
						if (k2 == k3)
							ans++;
						else
							ans += 3;
					}
					else
					{
						if (k2 == k3)
							ans += 3;
						else
							ans += 6;
					}
				}
			return false;
}
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt","w", stdout);
	i64 n;
	cin >> n;
	if (n % 3 != 0)
	{
		cout << "0";
		return 0;
	}
	vector<i64> a, b;
	for (i64 i = 1; i * i <= n; i++)
		if (n % i == 0)
		{
			if (i > 0) a.push_back(i);
			if (i * i != n)
				b.push_back(n / i);
		}
	for (int i = b.size()- 1; i >= 0; i--)
		a.push_back(b[i]);
	cerr << a.size() << endl;

	n /= 3;
	int Q = 0;
	for (int i = 0; i < a.size(); i++){

		i64 d = n / a[i];
		int x = lower_bound(a.begin(), a.end(), d) - a.begin();

		for (int j = x; j >= i; j--)
		if (d % a[j] ==0)
		{
			if (f(a[i], a[j], n))
				break;
		}

	}
	cout << ans;
	return 0;
}

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <cctype>
#include <climits>
#include <algorithm>
using namespace std;

long long n, n1,n2, ans;

void updateans(long long a, long long b, long long c)
{
    if(a>0 && b>0 && c>0)
    {
        if(a==b)
        {
            if(b==c) ans++;
                    else ans+=3;
        }
        else if(b==c) ans+=3;
                    else ans+=6;
    }
    return;
}

int main()
{
    long long i,j, k, iin, jjn;
    /*freopen("d:\\1.in","r",stdin);
    freopen("d:\\1.out","w",stdout);*/
    cin >> n;
    ans=0;
    if(n%3==0)
    {
        n/=3;
        for(i=2 , iin=pow(n, (double)1/3); i<=iin;i++)  // b+c
        if(n%i==0)
        for(j=i, n1=n/i, jjn=pow(n1, (double)1/2);j<=jjn;j++)
        if(n1%j==0)
        {
            k=n1/j;
            if((i+j+k)%2==0) n2=(i+j+k)/2; else continue;
            updateans(n2-i, n2-j, n2-k);
        }
    }
    cout << ans << endl;
    return 0;
}

#include<stack>
#include<algorithm>
#include<cassert>
#include<complex>
#include<map>
#include<iomanip>
#include<sstream>
#include<queue>
#include<set>
#include<string>
#include<cstdio>
#include<vector>
#include<iostream>
#include<cstring>
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define fup FOR
#define fdo FORD
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define siz SZ
#define CLR(x) memset((x), 0, sizeof(x))
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define FI X
#define SE Y
#define SQR(a) ((a)*(a))
#define DEBUG 1
#define debug(x) {if (DEBUG)cerr <<#x <<" = " <<x <<endl; }
#define debugv(x) {if (DEBUG) {cerr <<#x <<" = "; FORE(it, (x)) cerr <<*it <<", "; cout <<endl; }}
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int, int>P;
typedef vector<int>VI;
const int INF=1E9+7;
template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
set<LL> D;
int main(){
	ios_base::sync_with_stdio(false);
    LL n;
    cin >> n;
    if (n % 6 != 0) {
        cout << 0 << endl;
        return 0;
    }
    n /= 3;
    for (LL i = 2; i*i <= n; ++i) {
        if (n % i == 0) {
            D.insert(i);
        }
    }
    LL res = 0;
    FORE(it, D) {
        FORE(jt, D) {
            LL a = *jt;
            LL b = *it;
            if (a > b) break;
            LL m = a*b;
            if (m > n/b) break;
            if (n % m != 0) continue;
            int c = n/m;
            if (c < b) continue;
            if ((a+b+c) % 2 != 0) continue;
            if (a+b < c) continue;
           // debug(a);
          //  debug(b);
          //  debug(c);
            if (a == b && b == c) res++;
            else if (a == b || b == c) res += 3;
            else res += 6;
        }
    }
    cout << res << endl;

    return 0;
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

unsigned long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0 || n<=20) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

//  m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<=n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if (  (apb+bpc<=cpa) || (bpc+cpa<=apb) || (cpa+apb<=bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

long long ans,d,pd,a,b,c,n,m,i,si,k,apb,bpc,cpa,dar,j;
vector <long long> g;
main()
{

  cin>>n;
   if (n%3!=0 || n<=20) {cout<<0<<endl; return 0;}
   n=n/3;

   for (i=2;i*i<=n;i++)
    if (n%i==0)
     {
       g.push_back(i);
       if (i*i!=n)  g.push_back(n/i);
     }

   sort (g.begin(),g.end());

    k=g.size();

//  m=(a+b)(b+c)(c+a)

   for (i=0;g[i]*g[i]<=n;i++)
     {
       apb=g[i];
       dar=n/apb;

       for (j=i;g[j]*g[j]<=dar;j++)
        if (dar%g[j]==0 && dar/g[j]>1)
         {
          bpc=g[j];
          cpa=dar/g[j];

            if ( (apb+bpc<=cpa) || (bpc+cpa<=apb) || (cpa+apb<=bpc) )continue;
            if ( (apb+bpc+cpa)%2!=0) continue;
            if (apb<2 || bpc<2 || cpa<2) continue;
             a=(apb+bpc-cpa)/2;
             b=apb-a;
             c=bpc-b;

             apb=a; bpc=b; cpa=c;

            if (apb==bpc && bpc==cpa) ans+=1; else
            if (apb==bpc && bpc!=cpa) ans+=2; else
            if (apb!=bpc && bpc==cpa) ans+=2; else
             ans+=6;
         }
     }
    cout<<ans<<endl;
   // system ("pause");
}

#include <cstdio>
#include <algorithm>
inline unsigned int getuint(){
    char w=getchar();
    while (w<'0'||'9'<w) w=getchar();
    unsigned int ans=0;
    for (;'0'<=w&&w<='9';w=getchar()) ans=ans*10+w-'0';
    return ans;
}
inline unsigned long long getuint64(){
    char w=getchar();
    while (w<'0'||'9'<w) w=getchar();
    unsigned long long ans=0;
    for (;'0'<=w&&w<='9';w=getchar()) ans=ans*10+w-'0';
    return ans;
}
long long a[23333];
int main(){
    //freopen("ex.in", "r", stdin);
    long long n=getuint64();int m=0;
    if (n%3) return puts("0"), 0;
    n/=3;
    for (long long i=1;i*i<=n;i++) if (n%i==0){
        a[++m]=i;
        if (i*i<n) a[++m]=n/i;
    }
    std::sort(a+1, a+m+1);
    int ans=0;
    for (int i=1;i<=m;i++){
        //printf("%I64d\n", x);
        long long x=a[i];
        if (x*x*x>n) break;
        long long limit=n/x;
        for (int j=i;j<=m;j++) if (limit%a[j]==0){
            long long y=a[j];
            if (limit%y||y*y>limit) break;
            long long z=limit/y, t=x+y+z;
            if (t&1) continue;t>>=1;
            long long a=t-x, b=t-y, c=t-z;
            if (a<0||b<0||c<0) continue;
            if (a==b&&b==c) ans++;
            else if (a==b||b==c||a==c) ans+=3;
            else ans+=6;
        }
    }
    printf("%d\n", ans);
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

vector<long long> factor;
void getFactor(long long n)
{
    factor.clear();
    for(long long i = 1;i * i <= n;i++)
        if (n % i == 0)
            factor.push_back(i);

}

int main()
{
    long long n;

    scanf("%I64d", &n);
    if (n % 3)
    {
        printf("0\n");
        return 0;
    }
    n /= 3;
    getFactor(n);

    //printf("size %d\n", factor.size());
    long long res = 0;
    for(int i = 0;i < factor.size();i++)
    {
        long long a = n / factor[i];
        for(int j = 0;j <= i;j++)
        {
            if (a % factor[j]) continue;
            long long c = a / factor[j];
            if (c > factor[j]) continue;

            if (factor[i] >= factor[j] + c)
                continue;

            if (factor[i] == factor[j] && factor[j] == c)
                res++;
            else if (factor[i] == factor[j] || factor[j] == c)
                res += 3;
            else
                res += 6;

        }
    }
    printf("%I64d\n", res);
    return 0;
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <set>
#define MAXN 100010
#define INF 1000000007
#define MP(x,y) make_pair(x,y)
#define FI first
#define SE second
#define EPS 1e-8
using namespace std;
int yi[MAXN];
int main()
{
    //freopen("/home/moor/Code/input","r",stdin);
    long long n,tt;
    while(cin>>n)
    {
        int ans=0,a,b,c,tmp;
        if(n%3==0)
        {
            n/=3;
            int cnt=0;
            for(long long i=2;i*i<=n;++i)
                if(n%i==0)
                   yi[cnt++]=i;
            for(int i=0;i<cnt;++i)
                for(int j=i;j<cnt;++j)
                {
                    tt=(long long )(yi[i]*yi[j]);
                    if(n%tt==0&&n/tt>=yi[j])
                    {
                        tt=n/tt;
                        tmp=yi[i]+yi[j]+tt;
                        if(tmp&1)   continue;
                        if(yi[i]+yi[j]<=tt)  continue;
                        tmp/=2;
                        a=tmp-tt,b=tmp-yi[j],c=tmp-yi[i];
                        if(a==c)    ++ans;
                        else    ans+=a==b?3:6;
                    }
                }
        }
        printf("%d\n",ans);
    }
    return 0;
}

#include <cstdio>
#include <vector>
using namespace std;
long long N;
vector<long long>A;
bool check(long long a,long long b,long long c) {
    if(a+b<=c||a+c<=b||b+c<=a) return 0;
    if((a+b-c)%2==1||(b+c-a)%2==1||(a+c-b)%2==1) return 0;
    return 1;
}
int main()
{
    scanf("%I64d",&N);
    if(N%3!=0) {puts("0");getchar();getchar();return 0;}
    for(long long i=1;i*i<=N;i++) if(N%i==0)A.push_back(i);
    N/=3;
    int ret=0;
    for(int i=0;i<A.size();i++) {
        long long t=N/A[i];
        for(int j=0;j<A.size();j++) if(t%A[j]==0)
            if(check(A[i],A[j],t/A[j]))ret++;
    }
    printf("%d\n",ret);
    getchar();getchar();
    return 0;
}