#include <bits/stdc++.h>
using namespace std;
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;
}
long long n;
vector<long long> V;
long long 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() {
  cin >> n;
  if (n % 3) {
    cout << 0;
    return 0;
  }
  long long N = n / 3 * 4;
  for (int i = 2; i * 1ll * i <= N; i++)
    if (N % i == 0) {
      if (i * 1ll * i == N)
        V.push_back(i);
      else {
        V.push_back(i);
        V.push_back(N / i);
      }
    }
  sort((V).begin(), (V).end());
  int run = 0;
  long long 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;
      long long d = (a - b) * (a - b) + N / (a + b);
      long long x = (long long)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;
  return 0;
}
