#include <bits/stdc++.h>
using namespace std;
const int MAXINT = 1111 * 1111 * 1111;
const long long MAXLINT = MAXINT * 1ll * MAXINT;
const long double EPS = 1e-10;
long long n;
int e;
long long del[1000000];
int main() {
  scanf("%I64d", &n);
  long long ans = 0;
  if (n % 3 == 0) {
    n /= 3;
    for (long long i = 1; i * i <= n; i++)
      if (n % i == 0) {
        if (n >= i * i * i) del[e++] = i;
      }
    int p = 0;
    for (long long c = 1; 8 * c * c * c <= n; c++) {
      for (; p < e && del[p] - c < c; p++)
        ;
      for (int i = p; i < e; i++) {
        long long b = del[i] - c;
        if ((b + b) * (b + c) * (b + c) > n) continue;
        long long D = (b - c) * (b - c) + 4 * n / (b + c);
        long long DD = sqrt(D + 0.0);
        while (DD * DD > D) DD--;
        while (DD * DD < D) DD++;
        if (DD * DD != D) continue;
        long long 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;
}
