#include <bits/stdc++.h>
using namespace std;
long long N, M;
vector<long long> factor(long long n) {
  vector<long long> r;
  for (long long i = 1; i * i < n; i++) {
    if (n % i == 0) {
      r.push_back(i);
    }
  }
  sort(r.begin(), r.end());
  return r;
}
int main() {
  cin >> N;
  if (N % 3 == 0) {
    M = N / 3;
    vector<long long> f = factor(M);
    long long ans = 0;
    for (int i = 1; i < int(f.size()); i++) {
      long long p = M / f[i];
      for (long long a = 1; a < f[i]; a++) {
        long long y = p - a * a - a * f[i];
        if (y < 0) break;
        if (y < a) break;
        long long d = f[i] * f[i] - 4 * y;
        if (d < 0) continue;
        long long b = (f[i] + sqrt(f[i] * f[i] - 4 * y) + 0.5) / 2,
                  c = f[i] - b;
        if (b * c == y) {
          if (a <= b && a <= c) {
            if (a == b && a == c)
              ans++;
            else if (a == b || b == c || c == a)
              ans += 3;
            else
              ans += 6;
          } else {
            break;
          }
        }
      }
    }
    cout << ans << endl;
  } else {
    puts("0");
  }
  return 0;
}
