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
import static java.util.Arrays.deepToString;

import java.io.*;
import java.math.*;
import java.util.*;

public class C {

	static void solve() {
		long n = nextLong();
		if (n % 3 != 0) {
			writer.println(0);
			return;
		}
		long ans = solve(n / 3);
		writer.println(ans);
	}

	static int solve(long n) {
		ans = 0;
		setTime();
		ArrayList<BigInteger> primesList = Factorization.factorize(BigInteger.valueOf(n));
		Collections.sort(primesList);
		long[] primes = new long[primesList.size()];
		for (int i = 0; i < primes.length; i++) {
			primes[i] = primesList.get(i).longValue();
		}
		Arrays.sort(primes);
		go(primes, 0, 1, 1, 1);
		printTime();
		return ans;
	}

	static int ans;

	static void go(long[] primes, int pos, long x, long y, long z) {
		if (pos == primes.length) {
			long sum = x + y + z;
			if ((sum & 1) != 0)
				return;
			long a = (x + z - y) >> 1;
			long b = (x + y - z) >> 1;
			long c = (y + z - x) >> 1;
			if (a <= 0 || b <= 0 || c <= 0)
				return;
			ans++;
			return;
		}
		int pow = 1;
		while (pos + pow < primes.length && primes[pos + pow] == primes[pos]) {
			pow++;
		}
		for (int p1 = 0; p1 <= pow; p1++) {
			for (int p2 = 0; p2 <= pow - p1; p2++) {
				int p3 = pow - p1 - p2;
				long nx = x, ny = y, nz = z;
				for (int i = 0; i < p1; i++)
					nx *= primes[pos];
				for (int i = 0; i < p2; i++)
					ny *= primes[pos];
				for (int i = 0; i < p3; i++)
					nz *= primes[pos];
				go(primes, pos + pow, nx, ny, nz);
			}
		}
	}

	static int solveStupid(long n) {
		int ans = 0;
		for (long a = 1; a * a <= n; a++) {
			for (long b = 1; b * b <= n; b++) {
				for (long c = 1;; c++) {
					long val = (a + b) * (b + c) * (a + c);
					if (val > n)
						break;
					if (val == n) {
						ans++;
					}
				}
			}
		}
		return ans;
	}

	public static void main(String[] args) throws Exception {
		reader = new BufferedReader(new InputStreamReader(System.in));
		writer = new PrintWriter(System.out);

		setTime();
		solve();
		printTime();
		printMemory();

		writer.close();
	}

	static BufferedReader reader;
	static PrintWriter writer;
	static StringTokenizer tok = new StringTokenizer("");
	static long systemTime;

	static void debug(Object... o) {
		System.err.println(deepToString(o));
	}

	static void setTime() {
		systemTime = System.currentTimeMillis();
	}

	static void printTime() {
		System.err.println("Time consumed: " + (System.currentTimeMillis() - systemTime));
	}

	static void printMemory() {
		System.err.println("Memory consumed: "
				+ (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000 + "kb");
	}

	static String next() {
		while (!tok.hasMoreTokens()) {
			String w = null;
			try {
				w = reader.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			if (w == null)
				return null;
			tok = new StringTokenizer(w);
		}
		return tok.nextToken();
	}

	static int nextInt() {
		return Integer.parseInt(next());
	}

	static long nextLong() {
		return Long.parseLong(next());
	}

	static double nextDouble() {
		return Double.parseDouble(next());
	}

	static BigInteger nextBigInteger() {
		return new BigInteger(next());
	}

	static class Factorization {
		static Random rng = new Random(58);

		static ArrayList<BigInteger> factorize(BigInteger n) {
			ArrayList<BigInteger> ret = new ArrayList<BigInteger>();
			if (n.equals(BigInteger.ONE)) {
				return ret;
			}
			if (n.isProbablePrime(50)) {
				ret.add(n);
				return ret;
			}
			BigInteger divisor = rho(n);
			ret = factorize(divisor);
			ret.addAll(factorize(n.divide(divisor)));
			return ret;
		}

		static BigInteger rho(BigInteger n) {
			BigInteger x = new BigInteger(n.bitLength(), rng);
			BigInteger c = new BigInteger(n.bitLength(), rng);
			BigInteger xx = p(x, c, n);
			BigInteger divisor;
			while ((divisor = xx.subtract(x).gcd(n)).equals(BigInteger.ONE)) {
				x = p(x, c, n);
				xx = p(p(xx, c, n), c, n);
			}
			return divisor.equals(n) ? rho(n) : divisor;
		}

		static BigInteger p(BigInteger x, BigInteger c, BigInteger n) {
			return x.multiply(x).add(c).mod(n);
		}
	}

	static void generateDivisors(long[] primes, int pos, boolean prevUsed, long d, ArrayList<Long> divisors) {
		if (pos == primes.length) {
			divisors.add(d);
			return;
		}
		generateDivisors(primes, pos + 1, false, d, divisors);
		if (pos == 0 || primes[pos - 1] != primes[pos] || prevUsed) {
			generateDivisors(primes, pos + 1, true, d * primes[pos], divisors);
		}
	}

}