Problem: 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.

Input

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.

Output

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. 

Examples

Input

24


Output

1


Input

648


Output

7


Input

5


Output

0


Input

93163582512000


Output

39090

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
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 (int(i) = 0; (i) < (((int)((t).size()))); ++(i)) s << t[i] << " ";
  return s;
}
map<unsigned long long, int> roz;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  if (!a) return b;
  return gcd(b % a, a);
}
unsigned long long mult(unsigned long long a, unsigned long long b,
                        unsigned long long m) {
  if (!a || !b) return 0;
  if (b < (1LL << 31) && a < (1LL << 31)) return (a * b) % m;
  unsigned long long x = 0;
  while (b) {
    if (b & 1) x = (x + a) % m;
    a = (a << 1) % m;
    b >>= 1;
  }
  return x;
}
unsigned long long pow(unsigned long long n, unsigned long long k,
                       unsigned long long m) {
  unsigned long long w = 1;
  while (k) {
    if (k & 1) w = mult(w, n, m);
    n = mult(n, n, m);
    k >>= 1;
  }
  return w;
}
bool TRM(unsigned long long x, int ile) {
  if (x == 2 || x == 3) return 1;
  if (!(x % 2) || !(x % 3) || x == 1) return 0;
  unsigned long long z0 = x - 1;
  int t = 0;
  while (!(z0 & 1)) {
    z0 >>= 1;
    t++;
  }
  while (ile--) {
    unsigned long long b = pow(2 + rand() % (x - 3), z0, x);
    if (b == 1) continue;
    for (int j = 0; j < t && b != x - 1 && b != 1; j++) b = mult(b, b, x);
    if (b != x - 1) return 0;
  }
  return 1;
}
unsigned long long find_factor(unsigned long long z) {
  if (!(z & 1)) return 2;
  unsigned long long c = rand() % z, x = 2, y = 2, d = 1;
  while (d == 1) {
    unsigned long long tp = (mult(y, y, z) + c) % z;
    y = (mult(tp, tp, z) + c) % z;
    x = (mult(x, x, z) + c) % z;
    d = gcd(x > y ? x - y : y - x, z);
  }
  return d;
}
void rhofact(unsigned long long z) {
  if (z == 1) return;
  if (TRM(z, 10)) {
    roz[z]++;
    return;
  }
  while (1) {
    unsigned long long f = find_factor(z);
    if (f != z) {
      rhofact(f);
      rhofact(z / f);
      break;
    }
  }
}
vector<pair<long long, int> > rozklad(long long x) {
  roz.clear();
  rhofact(x);
  vector<pair<long long, int> > res;
  for (typeof(roz.begin()) it = roz.begin(); it != roz.end(); it++)
    res.push_back(*it);
  return res;
}
int main() {
  long long n;
  cin >> n;
  if (n % 3) {
    pisz(0);
    return 0;
  }
  n /= 3;
  vector<pair<long long, int> > roz = rozklad(n);
  int res = 0;
  int m = ((int)((roz).size()));
  vector<int> v(m, 0);
  while (1) {
    vector<int> w(m, 0);
    while (1) {
      long long a = 1, b = 1;
      for (int(j) = 0; (j) < (m); ++(j)) {
        for (int(u) = 0; (u) < (v[j]); ++(u)) a *= roz[j].first;
        for (int(u) = 0; (u) < (w[j]); ++(u)) b *= roz[j].first;
      }
      long long 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].second - 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].second) {
        v[j] = 0;
        j++;
      } else
        break;
    }
    if (j == m) break;
  }
  pisz(res);
}