#include <bits/stdc++.h>
using namespace std;
const int D = 50000;
long long n, d[D] = {}, ans = 0;
int tot = 0;
int main() {
  cin >> n;
  if (n % 3) {
    puts("0");
    return 0;
  }
  n /= 3;
  for (long long i = 2; 2 * i * i - i <= n; ++i)
    if (n % i == 0) d[++tot] = i;
  sort(d + 1, d + tot + 1);
  long long a = 1;
  int l = 1, r = tot;
  while (l <= r && ((d[l] + 4) * d[l] + 4) * d[l] < n * 4) ++l;
  while (true) {
    if (8 * a * a * a > n) break;
    for (int i = l; i <= r; ++i) {
      long long x = d[i];
      long long y = n / x - a * a - a * x;
      long long r = x * x - 4 * y, s = (int)sqrt(r);
      if (s * s == r && x - s > 0 && (x - s) % 2 == 0) {
        long long b = (x - s) / 2, c = (x + s) / 2;
        if (b >= a && c >= a) {
          if (a == b && b == c)
            ++ans;
          else if (a == b || b == c || c == a)
            ans += 3;
          else
            ans += 6;
        }
      }
    }
    ++a;
    while (l && ((d[l] + a * 4) * d[l] + a * a * 4) * d[l] >= n * 4) --l;
    while (l <= r && ((a + 1) * d[r] + a - 2) * d[r] >= n) --r;
  }
  cout << ans << endl;
  cerr << clock() << endl;
  return 0;
}
