import	java.util.*;
public	class	Main{
	public	static	void	main(String[]args){
		Scanner	cin=new	Scanner(System.in);
		long	s=0,n=cin.nextLong(),m,x=2,y,z;
		if(0==n%6)	for(n/=3;x*x*x<=n;++x)	if(1>n%x)
			for(z=2-x,y=Math.max(x,(int)Math.ceil((z+Math.sqrt(z*z+((m=n/x)<<2)))/2));y*y<=m;++y)
				if(1>m%y&&1>(1&(x^(z=m/y)^y)))
					s+=x==z?1:x==y||y==z?3:6;
		System.out.print(s);
	}
}

import java.util.*;

//n = 3(a+b)(a+c)(b+c)
public class C {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if(n%3 != 0) { System.out.println(0); return; }
		n/=3;

		long st = System.currentTimeMillis();
		List<Long> factors = new ArrayList<Long>();
		for(long f=1; f<=1000*1000*10; f++)
			if(n%f==0) factors.add(f);

		A: for(int i=0; i<factors.size(); i++) {
			long APB = factors.get(i);
			if(APB*APB*APB > n) continue A;
			for(int j=i; j<factors.size(); j++) {
				long APC = factors.get(j);
				if(APB*APC > n) continue A;
				long BPC = n / (APB*APC);

				long a = (APB + APC - BPC)/2;
				long b = (APB + BPC - APC)/2;
				long c = (APC + BPC - APB)/2;
				if(f(a,b,c)==n && a<=b && b<=c)
					add_ans(a,b,c);
			}
		}
		long ed = System.currentTimeMillis();
		//System.out.println(ed-st);
		System.out.println(ans);
	}
	static long ans = 0;
	static void add_ans(long a, long b, long c) {
		if(a<=0 || b<=0 || c<=0) return;
		if(a==b && b==c) ans++;
		else if(a==b && b!=c) ans+=3;
		else if(a==c && a!=b) ans+=3;
		else if(b==c && a!=b) ans+=3;
		else ans+=6;
	}
	static long f(long a, long b, long c) {
		return a*a*(b+c)+b*b*(a+c)+c*c*(a+b)+2*a*b*c;
	}
}

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);
		}
	}

}

import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.awt.geom.QuadCurve2D;
import java.io.*;

public class Copy_2_of_Main {

	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists())
				System.setIn(new FileInputStream("input.txt"));
		} catch (SecurityException e) {
		}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long time1 = System.currentTimeMillis();
					new Copy_2_of_Main().run();
					long time2 = System.currentTimeMillis();
					System.err.println("Time " + (time2 - time1) + " ms");
				} catch (Throwable e) {
					e.printStackTrace();
					exit(999);
				}
			}
		}, "1", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	private void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		in.close();
		out.close();
	}

	private void solve() throws IOException {
		long n = nextLong();
		if (n % 3 != 0) {
			out.println(0);
			return;
		}

		n /= 3;

		Set<long[]> set = new TreeSet<long[]>(new Comparator<long[]>() {

			@Override
			public int compare(long[] o1, long[] o2) {
				for (int i = 0; i < o1.length; i++)
					if (o1[i] != o2[i])
						return o1[i] < o2[i] ? -1 : 1;
				return 0;
			}
		});

		for (long x = 1L; x * x * x <= n; x++) {
			if (n % x != 0)
				continue;
			long m = n / x;
			for (long y = max(x, (long)(sqrt(n / 2 / x) + 0.001)); y * y <= m; y++) {
				if (m % y != 0)
					continue;
				long z = m / y;
				if (((x ^ y ^ z) & 1) != 0)
					continue;
				long u = (x + y + z) >> 1;
				long a = u - z;
				long b = u - y;
				long c = u - x;
				if (a > 0 && b > 0 && c > 0) {
					long[] q = new long[] { a, b, c };
					sort(q);
					set.add(q);
				}
			}
		}

		long[] f = {1, 1, 3, 6};

		long ans = 0;
		for (long[] t : set) {
			int count = 1;
			if (t[0] != t[1])
				count++;
			if (t[1] != t[2])
				count++;
			ans += f[count];
		}

//		System.err.println(set.size());
//		System.err.println(ans / 39090.);

		out.println(ans);
	}

	long pw3(long a) {
		return a * a * a;
	}

	class T implements Comparable<T> {
		long a, b, c;

		public T(long... x) {
			sort(x);
			this.a = x[0];
			this.b = x[1];
			this.c = x[2];
		}

		@Override
		public int compareTo(T t) {
			int cmp1 = Long.compare(a, t.a);
			if (cmp1 != 0)
				return cmp1;
			int cmp2 = Long.compare(b, t.b);
			if (cmp2 != 0)
				return cmp2;
			return Long.compare(c, t.c);
		}

	}

	void chk(boolean b) {
		if (b)
			return;
		System.out.println(new Error().getStackTrace()[1]);
		exit(999);
	}
	void deb(String fmt, Object... args) {
		System.out.printf(Locale.US, fmt + "%n", args);
	}
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}

import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.awt.geom.QuadCurve2D;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists())
				System.setIn(new FileInputStream("input.txt"));
		} catch (SecurityException e) {
		}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long time1 = System.currentTimeMillis();
					new Main().run();
					long time2 = System.currentTimeMillis();
					System.err.println("Time " + (time2 - time1) + " ms");
				} catch (Throwable e) {
					e.printStackTrace();
					exit(999);
				}
			}
		}, "1", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	private void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		in.close();
		out.close();
	}

	private void solve() throws IOException {
		long n = nextLong();
		if (n % 3 != 0) {
			out.println(0);
			return;
		}

		n /= 3;

		Set<long[]> set = new TreeSet<long[]>(new Comparator<long[]>() {

			@Override
			public int compare(long[] o1, long[] o2) {
				for (int i = 0; i < o1.length; i++)
					if (o1[i] != o2[i])
						return o1[i] < o2[i] ? -1 : 1;
				return 0;
			}
		});

		for (long x = 1L; x * x * x <= n; x++) {
			if (n % x != 0)
				continue;
			long m = n / x;
			for (long a = 1; 2 * a <= x; a++) {
				double[] w = new double[3];
				long b = x - a;
				w[0] = a * b - m;
				w[1] = a + b;
				w[2] = 1;
				int sl = QuadCurve2D.solveQuadratic(w);
				for (int i = 0; i < sl; i++) {
					long c = (long)(w[i] + 0.001);
					if (c > 0 && (a + c) * (b + c) == m) {
						long[] q = new long[] { a, b, c };
						sort(q);
						set.add(q);
					}
				}
			}
		}

		long[] f = {1, 1, 3, 6};

		long ans = 0;
		for (long[] t : set) {
			int count = 1;
			if (t[0] != t[1])
				count++;
			if (t[1] != t[2])
				count++;
			ans += f[count];
		}

//		System.err.println(set.size());
//		System.err.println(ans / 39090.);

		out.println(ans);
	}

	long pw3(long a) {
		return a * a * a;
	}

	class T implements Comparable<T> {
		long a, b, c;

		public T(long... x) {
			sort(x);
			this.a = x[0];
			this.b = x[1];
			this.c = x[2];
		}

		@Override
		public int compareTo(T t) {
			int cmp1 = Long.compare(a, t.a);
			if (cmp1 != 0)
				return cmp1;
			int cmp2 = Long.compare(b, t.b);
			if (cmp2 != 0)
				return cmp2;
			return Long.compare(c, t.c);
		}

	}

	void chk(boolean b) {
		if (b)
			return;
		System.out.println(new Error().getStackTrace()[1]);
		exit(999);
	}
	void deb(String fmt, Object... args) {
		System.out.printf(Locale.US, fmt + "%n", args);
	}
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}

import java.util.List;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskC {
    static final long inf = (long)(1E18);

    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long n = Long.parseLong(in.nextToken());
        if (n % 3L != 0) {
            out.printLine(0);
            return;
        }
        n /= 3L;
        ArrayList<Long> div = new ArrayList<Long>();
        for (long x = 1; x * x <= n; ++x) {
            if (n % x != 0L) continue;
            div.add(x);
            if (n / x != x) div.add(n / x);
        }
        Collections.sort(div);
        //Collections.reverse(div);
        long res = 0;
        for (int ai = 0; ai < div.size(); ++ai) {
            long a = div.get(ai);
            long ra = n / a;
            long a3 = to3(a);
            if (a3 < n) continue;
            int downi = 0, upi = ai;
            while (upi - downi > 1) {
                int t = (upi + downi) / 2;
                long b = div.get(t);
                long c = ra / b;
                long sum = b + c + 1;
                if (sum < a) {
                    downi = t;
                } else {
                    upi = t;
                }
            }
            //upi = 0;

            for (int bi = downi; bi <= ai; ++bi) {
                long b = div.get(bi);
                if (ra % b != 0) continue;
                long c = ra / b;
                if (c > b) continue;
                if (b + c <= a) continue;
                if ((a + b + c) % 2 == 1) continue;
                if (a == b && b == c) ++res;
                else if (a == b || b == c || a == c) res += 3;
                else res += 6;
            }

        }
        out.printLine(res);
    }

    private long to3(long a) {
        long x = a;
        if (inf / a <= x) return inf;
        x *= a;
        if (inf / a <= x) return inf;
        x *= a;
        return x;
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buffer = new byte[10000];
    private int cur;
    private int count;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public static boolean isSpace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int read() {
        if (count == -1) {
            throw new InputMismatchException();
        }
        try {
            if (cur >= count) {
                cur = 0;
                count = stream.read(buffer);
                if (count <= 0)
                    return -1;
            }
        } catch (IOException e) {
            throw new InputMismatchException();
        }
        return buffer[cur++];
    }

    public int readSkipSpace() {
        int c;
        do {
            c = read();
        } while (isSpace(c));
        return c;
    }

    public String nextToken() {
        int c = readSkipSpace();
        StringBuilder sb = new StringBuilder();
        while (!isSpace(c)) {
            sb.append((char) c);
            c = read();
        }
        return sb.toString();
    }

    }

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {

	long n;

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		n = in.nextLong();
		if (n % 3 != 0) {
			out.println(0);
			return;
		}
		n /= 3;
		int ans = 0;
		for (long ab = 2; ab * ab * ab <= n; ++ab) {
			if (n % ab != 0) {
				continue;
			}
			long left = n / ab;
			for (long a = 1; a * 2 <= ab; ++a) {
				long b = ab - a;
				long A = 1;
				long B = ab;
				long C = a * b - left;
				long discr = B * B - 4 * A * C;
				if (discr < 0) {
					continue;
				}
				long root = (long) Math.sqrt(discr) - 2;
				while (root * root < discr) {
					++root;
				}
				if (root * root != discr) {
					continue;
				}
				long c = (-B + root) / 2 / A;
				if (c >= b) {
					long mult = (a + c) * (b + c);
					if (mult == left) {
						int cur = 1;
						if (b > a) {
							cur *= 3;
							if (c > b) {
								cur *= 2;
							}
						} else if (c > b) {
							cur *= 3;
						}
						ans += cur;
					}
				}
			}
		}
		out.println(ans);
	}
}

class InputReader {
	private final BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = new StringTokenizer("");
	}

	public String next() {
		while (!tokenizer.hasMoreTokens()) {
			try {
				String line = reader.readLine();
				if (line == null) {
					return null;
				}
				tokenizer = new StringTokenizer(line);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return tokenizer.nextToken();
	}

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

	}

class OutputWriter extends PrintWriter {

	public OutputWriter(Writer out) {
		super(out);
	}

	public OutputWriter(OutputStream out) {
		super(out);
	}

	}

import	java.util.*;
public	class	Main{
	public	static	void	main(String[]args){
		int	s=0,i=0,j,x,Q[]=new	int[9999];
		Scanner	cin=new	Scanner(System.in);
		long	n=cin.nextLong(),m,y=2,z;
		if(0==n%6)	for(n/=3;y*y<<1<=n;++y)	if(1>n%y)
			for(j=(z=(m=n/y)/y)<(Q[i++]=(int)y)?Algorithm.UpperBound(Q,1,i,(int)z):i;0<j--&&1<((x=Q[j])+y-(z=m/Q[j]));)
				if(1>(1&(x^y^z))&&x*z==m)
					s+=x==z?1:x==y||y==z?3:6;
		System.out.print(s);
	}
}
final	class	Algorithm{
	private	Algorithm(){}
	public	static	int	UpperBound(int[]Q,int	l,int	r,int	v){
		return	Math.abs(1+Arrays.binarySearch(Q,l,r,v));
	}
	public	static	int	UpperBound(int[]Q,int	v){
		return	UpperBound(Q,0,Q.length,v);
	}
}

import	java.util.*;
public	class	Main{
	public	static	void	main(String[]args){
		Scanner	cin=new	Scanner(System.in);
		long	s=0,n=cin.nextLong(),m,x=2,y,z,a,b,c;
		if(0==n%6)	for(n/=3;x*x*x<=n;++x)	if(1>n%x)
			for(z=2-x,y=Math.max(x,(int)Math.ceil((z+Math.sqrt(z*z+((m=n/x)<<2)))/2));y*y<=m;++y)
				if(1>m%y&&1>(1&(x^(z=m/y)^y)))
				{a=x+y-z;s+=(c=(y<<1)-a)==a?1:(b=(x<<1)-a)==a||b==c?3:6;}
		System.out.print(s);
	}
}

import java.io.*;

import static java.lang.Math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) {
		if(new File("input.txt").exists())
			try {
				System.setIn(new FileInputStream("input.txt"));
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "kek", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Locale.setDefault(Locale.US);
//		long t = System.currentTimeMillis();
		solve();
//		System.err.println(System.currentTimeMillis() - t);
		in.close();
		out.close();
	}

	long prev[];

	void solve() throws IOException{
		long r = nextLong();
		if(r % 3 != 0) {
			out.println(0);
			return;
		}
		long n = r / 3;
		long sq = (long) (pow(n, 1/3.0) + 10);
		long ans = 0;
		for(long x = 1; x <= sq; x++){
			if(n % x == 0){
				for(long a = 1; a <= x / 2 ; a++){
					long b = x - a;
					long f = a + b;
					long e = a * b - n / (a + b);
					long D = f * f - 4 * e;
					double z = sqrt(D);
					z = (-f + z) / 2;
					long c = Math.round(z);
					if(c <= 0 || (a + b) > (a + c) || (a + b) > (b + c) || (a + c) > (b + c)) continue;

					if( (a + b) * (a + c) * (b + c) == n){
						int k = 0;
						if(a != b) k++;
						if(a != c) k++;
						if(b != c) k++;
						if(k == 0)
							ans += 1;
						if(k == 2){
							ans += 3;
						}
						if(k == 3){
							ans += 6;
						}
					}
				}
			}
		}
		out.println(ans);
	}

	String nextToken() throws IOException{
		while(!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	long nextLong() throws IOException{
		return Long.parseLong(nextToken());
	}
	int nextInt() throws IOException{
		return Integer.parseInt(nextToken());
	}
	double nextDouble() throws IOException{
		return Double.parseDouble(nextToken());
	}
}

import java.io.*;

import static java.lang.Math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) {
		if(new File("input.txt").exists())
			try {
				System.setIn(new FileInputStream("input.txt"));
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "kek", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Locale.setDefault(Locale.US);
//		long t = System.currentTimeMillis();
		solve();
//		System.err.println(System.currentTimeMillis() - t);
		in.close();
		out.close();
	}

	long prev[];

	void solve() throws IOException{
		long r = nextLong();
		if(r % 3 != 0) {
			out.println(0);
			return;
		}
		long n = r / 3;
		long ans = 0;
		for(long x = 1; x * x * x <= n; x++){
			if(n % x == 0){
				for(long a = 1; a <= x / 2 ; a++){
					long b = x - a;
					long f = a + b;
					long e = a * b - n / (a + b);
					long D = f * f - 4 * e;
					double z = sqrt(D);
					z = (-f + z) / 2;
					long c = Math.round(z);
					if(c <= 0 || (a + b) > (a + c) || (a + b) > (b + c) || (a + c) > (b + c)) continue;

					if( (a + b) * (a + c) * (b + c) == n){
						int k = 0;
						if(a != b) k++;
						if(a != c) k++;
						if(b != c) k++;
						if(k == 0)
							ans += 1;
						if(k == 2){
							ans += 3;
						}
						if(k == 3){
							ans += 6;
						}
					}
				}
			}
		}
		out.println(ans);
	}

	String nextToken() throws IOException{
		while(!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	long nextLong() throws IOException{
		return Long.parseLong(nextToken());
	}
	int nextInt() throws IOException{
		return Integer.parseInt(nextToken());
	}
	double nextDouble() throws IOException{
		return Double.parseDouble(nextToken());
	}
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Egor Kulikov (egor@egork.net)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
		long count = in.readLong();
		if (count % 3 != 0) {
			out.printLine(0);
			return;
		}
		count /= 3;
		int answer = 0;
		for (long i = 2; i * i * i <= count; i++) {
			if (count % i != 0)
				continue;
			long remaining = count / i;
			long minJ = (long) Math.max(i, Math.sqrt(remaining) - i / 2 - 10);
			for (long j = minJ; j * j <= remaining; j++) {
				if (remaining % j != 0)
					continue;
				long k = remaining / j;
				long a = i + j - k;
				long b = i + k - j;
				long c = j + k - i;
				if (a < 2 || b < 2 || c < 2 || (a & 1) != 0)
					continue;
				if (a == b && a == c)
					answer++;
				else if (a == b || a == c || b == c)
					answer += 3;
				else
					answer += 6;
			}
		}
		out.printLine(answer);
    }
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

    public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}

	}

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.sort;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		long n = nextLong();
		if (n % 3 != 0) {
			out.print(0);
			return;
		}
		n /= 3;
		long divisors[] = new long[4096];
		int divCnt = 0;
		for (int i = 1; (long) i * i <= n; i++) {
			if (n % i != 0) {
				continue;
			}
			if (divCnt + 1 >= divisors.length) {
				divisors = copyOf(divisors, divisors.length << 1);
			}
			divisors[divCnt++] = i;
			if ((long) i * i < n) {
				divisors[divCnt++] = n / i;
			}
		}
		sort(divisors, 0, divCnt);
		int ans = 0;
		for (int i = 0; i < divCnt; i++) {
			long dI = divisors[i];
			long qI = n / dI;
			for (int j = i; j < divCnt; j++) {
				long dJ = divisors[j];
				if (qI % dJ != 0) {
					continue;
				}
				long qJ = qI / dJ;
				if (qJ < dJ) {
					break;
				}
				long sum = dI + dJ + qJ;
				if ((sum & 1) != 0) {
					continue;
				}
				sum >>= 1;
				long a = sum - dI;
				long b = sum - dJ;
				long c = sum - qJ;
				if ((a | b | c) < 0 || a == 0 || b == 0 || c == 0) {
					continue;
				}
				if (a == b) {
					if (b == c) {
						++ans;
					} else {
						ans += 3;
					}
				} else {
					if (b == c) {
						ans += 3;
					} else {
						ans += 6;
					}
				}
			}
		}
		out.print(ans);
	}

	static int nextInt() throws IOException {
		return parseInt(next());
	}

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.*;

public class C2 {

    private static long n;
    private static Map<Long, Integer> primes;
    private static List<Long> primesList;
    private static List<Triple> aL = new ArrayList<Triple>();

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        n = in.nextLong();
        if (n % 3 != 0) out.print(0);
        else {
            primes = new HashMap<Long, Integer>();
            n /= 3;
            long t = n;
            for (long i = 2; i * i <= t; i++) {
                if (t % i == 0) {
                    if (primes.get(i) == null) primes.put(i, 0);
                    primes.put(i, primes.get(i) + 1);
                    t /= i;
                    i--;
                }
            }
            if (primes.get(t) == null) primes.put(t, 0);
            primes.put(t, primes.get(t) + 1);

            primesList = new ArrayList<Long>(primes.keySet());

            Map<Long, Integer> counts = new HashMap<Long, Integer>();
            for (Long integer : primes.keySet()) {
                counts.put(integer, 0);
            }

            out.println(calc(0, 1, counts));

            Collections.sort(aL, new Comparator<Triple>() {
                @Override
                public int compare(Triple o1, Triple o2) {
                    final int i = (int) (o1.a - o2.a);
                    return i != 0 ? i : (int) (o1.b - o2.b);
                }
            });

            for (int i = 0; i < aL.size(); i++) {
                out.println(aL.get(i));
            }
        }

        out.close();
    }

    private static int calc(int i, long k, Map<Long, Integer> counts) {
        if (i == primesList.size()) {
            int ans = 0;
            if (k != 1) {
                for (int a = 1; a <= k / 2; a++) {
                    long d = k * k - (4 * (a * (k - a) - n / k));
                    long kD = (long) Math.floor(Math.sqrt(d));
                    if (d > 0 && kD * kD == d && kD - k > 0 && (kD - k) % 2 == 0) {
                        final long b = k - a;
                        final long c = (kD - k) / 2;
                        if (b <= c) {
//                            final Triple e = new Triple(a, b, c);
//                            System.out.println(e);
//                            aL.add(e);
                            final int count = count(a, b, c);
//                            System.out.println(count);
//                            System.out.println((a + b) * (a + c) * (b + c));
                            ans += count;
                        }
                    }
                }
            }
            return ans;
        }
        int ans = 0;
        long prime = primesList.get(i);
        int count = primes.get(prime);
        long t = 1;
        counts.put(prime, 0);
        while (counts.get(prime) <= count) {
            final long tK = k * t;
            if (tK > Math.pow(n, 1d / 3)) {
                break;
            }
            ans += calc(i + 1, tK, counts);
            counts.put(prime, counts.get(prime) + 1);
            t *= prime;
        }
        return ans;
    }

    private static int count(long a, long b, long c) {
        if (a == b && a == c) return 1;
        if (a != b && a != c && b != c) return 6;
        return 3;
    }

    private static class Triple {
        private final long a;
        private final long b;
        private final long c;

        private Triple(long a, long b, long c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        @Override
        public String toString() {
            return a + " " + b + " " + c;
        }
    }

}

import java.util.*;

public class Main {

	private static int search(long[] a, long key) {
		int lo = 0, hi = a.length - 1;
		while(lo < hi) {
			int mid = (lo + hi)/2;
			if(a[mid] > key)
				hi = mid - 1;
			else if(a[mid] < key)
				lo = mid + 1;
			else return mid;
		}
		return lo;
	}
	@SuppressWarnings("resource")
	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if(n % 3 != 0)
			System.out.println(0);
		else {
			int count = 0, size = 0;
			n = n/3;
			Vector<Long> vc = new Vector<Long>();
			for(long x = 2; x * x <= n; x++) {
				if(n % x == 0) {
					vc.addElement(x);
					size++;
				}
			}
			if(size == 0)
				System.out.println(0);
			else {
				long[] a = new long[size];
				for(int i = 0; i < size; i++) {
					a[i] = vc.elementAt(i);
				}
				long thres = (long) Math.pow(n, 1.0/3);
				int m = search(a, thres);
				for(int i = 0; i <= m; i++) {
					long x = a[i];
					long t = n / x;
					int k = search(a, (long) Math.pow(t, 0.5));
					for(int j = i; j <= k; j++) {
						if(t % a[j] == 0) {
							long y = a[j];
							long z = t / y;
							if(x + y > z && (x + y + z) % 2 == 0 && y <= z) {
								if(x == y && y == z)
									count++;
								else if(x == y || y == z)
									count += 3;
								else
									count += 6;
							}
						}
					}
				}
				System.out.println(count);
			}
		}
	}

}

import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Niyaz Nigmatullin
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        long n = in.nextLong();
        if (n % 3 != 0) {
            out.println(0);
            return;
        }
        n /= 3;
        long[] divisors;
        {
            List<Long> d = new ArrayList<>();
            for (long i = 1; i * i <= n; i++) {
                if (n % i == 0) {
                    d.add(i);
                    if (i * i != n) d.add(n / i);
                }
            }
            divisors = new long[d.size()];
            for (int i = 0; i < divisors.length; i++) {
                divisors[i] = d.get(i);
            }
            Arrays.sort(divisors);
        }
        long ans = 0;
        for (long ac : divisors) {
            for (long ab : divisors) {
                if (ab > ac) {
                    break;
                }
                if ((n / ac) % ab != 0) {
                    continue;
                }
                long bc = n / ac / ab;
                if (bc < ac || bc < ab) {
                    break;
                }
                long twiceB = ab + bc - ac;
                if ((twiceB & 1) != 0) {
                    continue;
                }
                long b = twiceB >> 1;
                long a = ab - b;
                if (a <= 0) {
                    continue;
                }
                long c = bc - b;
                if (c <= 0 || c < b) {
                    continue;
                }
                if ((a + b) * (b + c) * (a + c) == n) {
                    if (a == b && b == c) {
                        ans++;
                    } else if (a == b || b == c) {
                        ans += 3;
                    } else {
                        ans += 6;
                    }
                }
            }
        }
        out.println(ans);
    }
}

class FastScanner extends BufferedReader {

    boolean isEOF;

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
            if (isEOF && ret < 0) {
                throw new InputMismatchException();
            }
            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    public String next() {
        StringBuilder sb = new StringBuilder();
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        if (c < 0) {
            return null;
        }
        while (c >= 0 && !isWhiteSpace(c)) {
            sb.appendCodePoint(c);
            c = read();
        }
        return sb.toString();
    }

    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }

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

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    }

class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
        super(out);
    }

    public FastPrinter(Writer out) {
        super(out);
    }

}

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

public class C {

	static void solve() throws IOException {
		long n = nextLong();
		long ways = solve(n);
		out.println(ways);
	}

	private static long solve(long n) {
		if (n % 3 != 0) {
			return 0;
		}
		n /= 3;

		Factor[] factors = factorize(n);

//		System.err.println(ArraystoString(factors));
		int[] pows = new int[factors.length];
		C.n = n;
		C.factors = factors;
		C.pows1 = pows;
		C.pows2 = new int[factors.length];
		C.productLeft = new long[factors.length + 1];

		go1(0, 1);
		return ways;
	}

	static Factor[] factors;
	static int[] pows1;

	static int[] pows2;
	static long[] productLeft;

	static long n;

	static long number1;

	static long ways;

	private static void go1(int start, long number) {
		if (start == factors.length) {
			productLeft[factors.length] = 1;
			for (int i = factors.length - 1; i >= 0; --i) {
				productLeft[i] = productLeft[i + 1];
				for (int j = 0; j < factors[i].pow - pows1[i]; j++) {
					productLeft[i] *= factors[i].p;
				}
			}
			long allLeft = productLeft[0];
			if (number > allLeft) {
				return;
			}
			if (number * number > allLeft) {
				return;
			}
			number1 = number;
			go2(0, 1);
			return;
		}

		for (int pow = 0; pow <= factors[start].pow; pow++) {
			pows1[start] = pow;
			go1(start + 1, number);
			number *= factors[start].p;
		}
	}

	private static void go2(int start, long number) {
		if (start == factors.length) {
			long number2 = number;
			long number3 = n / number1 / number2;
			check(number1, number2, number3);
			return;
		}
		if (productLeft[start] * number < number1) {
			return;
		}
		long ok = n / (number1 * number);
		if (ok < number1 || ok < number) {
			return;
		}

		for (int pow = 0; pow + pows1[start] <= factors[start].pow; pow++) {
			pows2[start] = pow;
			go2(start + 1, number);
			number *= factors[start].p;
		}
	}

	private static void check(long number1, long number2, long number3) {
		long sum = (number1 + number2 + number3);
		if ((sum & 1) != 0) {
			return;
		}
		if (number1 > number2 || number2 > number3) {
			return;
		}
		if (sum <= 2 * number3) {
			return;
		}

		if (number1 < number2 && number2 < number3) {
			ways += 6;
		} else {
			if (number1 == number2 && number2 == number3) {
				++ways;
			} else {
				ways += 3;
			}
		}
	}

	static Factor[] factorize(long n) {
		List<Factor> list = new ArrayList<>();
		if (n % 2 == 0) {
			list.add(new Factor(2, Long.numberOfTrailingZeros(n)));
			n >>= Long.numberOfTrailingZeros(n);
		}
		for (long p = 3; p * p <= n; p++) {
			if (n % p != 0) {
				continue;
			}
			int pow = 0;
			while (n % p == 0) {
				++pow;
				n /= p;
			}
			list.add(new Factor(p, pow));
		}
		if (n > 1) {
			list.add(new Factor(n, 1));
		}
		return (Factor[]) list.toArray(new Factor[list.size()]);
	}

	static class Factor {
		long p;
		int pow;

		public Factor(long p, int pow) {
			this.p = p;
			this.pow = pow;
		}

		@Override
		public String toString() {
			return "Factor [p=" + p + ", pow=" + pow + "]";
		}
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		InputStream input = System.in;
		PrintStream output = System.out;
		File file = new File("c.in");
		if (file.exists() && file.canRead()) {
			input = new FileInputStream(file);
		}
		br = new BufferedReader(new InputStreamReader(input));
		out = new PrintWriter(output);
		solve();
		out.close();
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	static String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}
}

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

public class SolC {
    public static void main(String[] args) {
        new SolC().run();
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;
    boolean eof = false;
    Random rand = new Random(3267347);

    private void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(566);
        }
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(nextToken());
    }

    long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    long MAGIC = 40000;
    long ans = 0;

    void check(long a, long b, long c, long n) {
        if (a % 2 != 0) return;
        a /= 2;
        if (a < b) return;
        if (a < 1 || b < 1 || c < 1) return;
        long t = (b + c) * (a * a + a * (b + c) + b * c);
        if (n == t) {
            int add = 1;
            if (a != b) {
                if (b != c) {
                    add *= 6;
                } else {
                    add *= 3;
                }
            } else if (a != c) {
                add *= 3;
            }
            ans += add;
        }
    }

    private void solve() throws IOException {
        long n = nextLong();
        if (n % 3 != 0) {
            out.println(0);
            return;
        }
        n /= 3;
//      int cnt = 0;
//      long max = 0;
        for (long bc = 1; bc <= 2 * MAGIC; bc++) {
            if (n % bc != 0) {
                continue;
            }
            long bc2 = bc * bc;
            long t = n / bc;
            for (long b = bc / 2; b < bc; b++) {
                long c = bc - b;
                if (c > b) continue;
                long d = bc2 - 4 * (b * c - t);
//              if (d % 2 == 0 && d % 4 != 0) continue;
//              if (d % 3 == 0 && d % 9 != 0) continue;
                long dd = Math.round(Math.sqrt(d));
                if (dd * dd != d) {
                    continue;
                }
//              cnt++;
//              max = Math.max(dd, max);
                long a1 = (-bc - dd);
                long a2 = (-bc + dd);
                check(a1, b, c, n);
                check(a2, b, c, n);
//              if (a1 % 2 == 0 && a1 >= b && a1 >= c) {
//                  ans++;
//              }
//              if (a2 % 2 == 0 && a2 >= b && a2 >= c) {
//                  ans++;
//              }
            }
        }
//      System.err.println(cnt);
//      System.err.println(max);
        out.println(ans);
    }
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class E {
	static ArrayList<Integer> primes;
	static ArrayList<Integer> count;
	static ArrayList<Long> divisors;

	public static void fill(int idx, long cur) {
		if (idx == primes.size()) {
			divisors.add(cur);
			return;
		}
		long pow = 1;
		for (int i = 0; i <= count.get(idx); i++) {
			fill(idx + 1, cur * pow);
			pow *= primes.get(idx);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		if (n % 3 != 0) {
			System.out.println(0);
			return;
		}
		primes = new ArrayList<Integer>();
		count = new ArrayList<Integer>();
		n /= 3;
		long sqrt = (long) Math.sqrt(n) + 1;
		long tmp = n;
		for (int i = 2; i <= sqrt; i++) {
			if (tmp % i == 0) {
				int cnt = 0;
				while (tmp % i == 0) {
					tmp /= i;
					cnt++;
				}
				primes.add(i);
				count.add(cnt);
			}
		}
		divisors = new ArrayList<Long>();
		fill(0, 1);
		Collections.sort(divisors);
		long res = 0;
		for (int i = 0; i < divisors.size(); i++) {
			long cand = divisors.get(i);
			long cube = cand * cand * cand;
			if (cube > 0 && cube <= n) {
				loop: for (int j = i; j < divisors.size(); j++) {
					long cand1 = divisors.get(j);
					cube = cand * cand1 * cand1;
					if (cube > 0 && cube <= n) {
						if (n % (cand * cand1) == 0) {
							long cand2 = n / (cand * cand1);
							long a2 = cand2 - cand1 + cand;
							if (a2 % 2 != 0) {
								continue loop;
							} else {
								long a = a2 / 2;
								if (cand - a > 0 && cand2 - a > 0) {
									if (cand == cand1 && cand1 == cand2) {
										res++;
									} else if (cand == cand1 || cand1 == cand2
											|| cand == cand2) {
										res += 3;
									} else {
										res += 6;
									}
								}
							}
						}
					}
				}
			} else {
				break;
			}
		}
		System.out.println(res);
	}
}

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

public class C implements Runnable {
	public static void main(String[] args) {
		new Thread(new C()).run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}

		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public void solve() throws IOException {
		ArrayList<Long> div = new ArrayList<Long>();

		long n = nextLong();

		if (n % 3 != 0) {
			out.println(0);
			return;
		}

		n /= 3;

		long d;
		for (d = 1; d * d < n; d++) {
			if (n % d == 0) {
				div.add(d);
				div.add(n / d);
			}
		}

		if (d * d == n)
			div.add(d);

		Collections.sort(div);

		int ans = 0;
		for (int i = div.size() - 1; i >= 0; i--) {
			long x = div.get(i);
			long nn = n / div.get(i);
			int j;
			long y;
			for (j = 0, y = div.get(j); y * y <= nn && y <= x; j++, y = div
					.get(j)) {
				if (nn % y != 0)
					continue;
				long z = nn / y;

				if (x >= y + z || z > x || ((x + y + z) & 1) != 0)
					continue;

				if (x == y && y == z) {
					ans++;
					continue;
				}
				if (x == z || y == z) {
					ans += 3;
					continue;
				}
				ans += 6;
			}
		}

		out.println(ans);
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}

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

public class z5 {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		long n=in.nextLong();
        long s=0;
        long[] del=new long[100001];
        int ch=0;
        if (n%3!=0) {out.println(0);} else
        {
        	n=n/3;
        	long t= (long) Math.sqrt(n+1);
        	for (long i=2;i<=t;i++) if (n%i==0) {ch++;del[ch]=i;}
        	for (int k1=1;k1<=ch;k1++)
        	{
        			long n1=n/del[k1];
        			for (int k2=1;k2<=ch;k2++)
        			{
        				if (n1%del[k2]==0)
        				{
        					long k3=n1/del[k2];
        					long a=del[k1]+del[k2]-k3;
        					if (a>0) if (a%2==0)
        					{
        						a=a/2;
        						if ((del[k2]>a)&&(del[k1]>a)) s++;
        					}
        				}
        			}
        	}
        	out.println(s);
        }
		out.flush();
	}
}

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

public class C {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		long n = nextLong();
		if (n % 3 != 0) {
			out.println(0);
			return;
		}

		n /= 3;

		ArrayList<Long> divAL = new ArrayList<>();
		for (long i = 1; i * i <= n; i++) {
			if (n % i == 0) {
				divAL.add(i);
				if (i * i != n)
					divAL.add(n / i);
			}
		}

		Collections.sort(divAL);

		long[] div = new long[divAL.size()];
		for (int i = 0; i < div.length; i++)
			div[i] = divAL.get(i);

		int ans = 0;
		for (int bigInd = 0; bigInd < div.length; bigInd++) {
			long big = div[bigInd];
			long rest = n / big;

			for (int smallInd = 0; smallInd <= bigInd; smallInd++) {
				long small = div[smallInd];
				if (small * small > rest)
					break;
				if (rest % small != 0)
					continue;
				long mid = rest / small;
				if (mid <= big && small + mid > big) {
					if (((big ^ mid ^ small) & 1) == 0) {

						if (big == mid && mid == small)
							ans++;
						else if (big == mid || mid == small)
							ans += 3;
						else
							ans += 6;

					}
				}
			}
		}
		out.println(ans);
	}

	C() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new C();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Locale;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;

public class C {

	private void solve() throws IOException {
		long n = nextLong();

		if (n % 3 != 0) {
			println("0");
			return;
		}

		n /= 3;

		int res = 0;
		for (long i = 1; i * i * i <= n; i++) {
			if (n % i != 0) {
				continue;
			}

			for (long a = 1; a * a <= n && a + a <= i; a++) {
				long b = i - a;
				long m = n / i;
				long d = i * i - 4 * (a * b - m);

				if (d <= 0) {
					continue;
				} else {
					long sq = (long)Math.sqrt(d);
					if (sq * sq != d || sq < i || (sq - i) % 2 == 1) {
						continue;
					}

					long c = (sq - i) / 2;
					if (c < a || c < b) {
						continue;
					}

					if (a == b && a == c) {
						res++;
					} else if (a != b && a != c && b != c) {
						res += 6;
					} else {
						res += 3;
					}
				}
			}
		}

		println(res);
	}

	private String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	private int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	private double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private void print(Object o) {
		writer.print(o);
	}

	private void println(Object o) {
		writer.println(o);
	}

	private void printf(String format, Object... o) {
		writer.printf(format, o);
	}

	public static void main(String[] args) {
		long time = System.currentTimeMillis();
		Locale.setDefault(Locale.US);
		new C().run();
		System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time));
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	private void run() {
		try {
			reader = new BufferedReader(new InputStreamReader(System.in));
			writer = new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(13);
		}
	}
}

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {
    FastScanner in;
    PrintWriter out;

    public void solve() throws IOException {
        long n = in.nextLong();

        long ans = count(n);
        out.println(ans);
    }

    long count(long n) {
        if (n % 3 != 0) {
            return 0;
        }

        n /= 3;

        long r = 0;
        long maxx = cuberoot(n);

        long[] divs = factor(n);

        for (int i = 0; i < divs.length && divs[i] <= maxx; i++) {
            long x = divs[i];
            long nab = n / x;
            long maxy = sqroot(nab);
            for (int j = i; j < divs.length && divs[j] <= maxy; j++) {
                long y = divs[j];
                if (nab % y != 0) {
                    continue;
                }
                long z = nab / y;

                if ((x + y + z) % 2 != 0) {
                    continue;
                }

                long a = (x + y - z) / 2;
                long b = (x - y + z ) / 2;
                long c = (-x + y + z) / 2;

                if (a > 0 && b > 0 && c > 0 && (a + b) * (a + c) * (b + c) == n) {
//                    System.out.println(a + " " + b + " " + c);
                    if (a == b && a == c) {
                        r++;
                    } else if (a == b || a == c || b == c) {
                        r += 3;
                    } else {
                        r += 6;
                    }
                }
            }
        }

        return r;
    }

    long[] factor(long n) {
        ArrayList<Long> ans = new ArrayList<Long>();
        for (long x = 1; x * x <= n; x++) {
            if (n % x == 0) {
                ans.add(x);
                if (n / x != x) {
                    ans.add(n / x);
                }
            }
        }
        long[] r = new long[ans.size()];
        for (int i = 0; i < ans.size(); i++) {
            r[i] = ans.get(i);
        }
        Arrays.sort(r);
        return r;
    }

    long cuberoot(long n) {
        long l = 0;
        long r = Math.round(Math.sqrt(n));
        while (l < r - 1) {
            long m = (l + r) / 2;
            if (m * m * m <= n) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    long sqroot(long n) {
        long l = 0;
        long r = Math.round(Math.sqrt(n)) + 10;
        while (l < r - 1) {
            long m = (l + r) / 2;
            if (m * m <= n) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    public void run() {
        try {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] arg) {
        new C().run();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) throws IOException {
            br = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                    return "";
                }
            }
            return st.nextToken();
        }

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

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

import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class E {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		long input = sc.nextLong();

		long tmp1 = 2L;
		if (input % 3 != 0) {
			System.out.println(0);
			return;
		}
		long tmp2 = input/3;
		long cnt = 0L;
		List<Long> arr1 = new LinkedList<Long>();
		List<Long> arr2 = new LinkedList<Long>();

		while (tmp2 > 1) {
			if (tmp2 % tmp1 == 0L) {
				++cnt;
				tmp2 /= tmp1;
			}
			else {
				if (cnt != 0L) {
					arr1.add(tmp1);
					arr2.add(cnt);
					cnt = 0L;
				}
				++tmp1;
			}
		}
		if (cnt != 0L) {
			arr1.add(tmp1);
			arr2.add(cnt);
		}

		System.out.println(
							cnt(	input/3, arr1.toArray(new Long[0]), arr2.toArray(new Long[0]),
									0, 1, 1, false));
	}

	private static long cnt (long n, Long[] arr1, Long[] arr2, int ind,
							long x1, long x2, boolean cntX2) {
		if (ind == arr1.length)
			if (cntX2) {
				long x3 = n / x1 / x2;
				if (x1 >= x2 && x2 >= x3 && x3 + x2 > x1 && (x1+x2+x3)%2 == 0)
					if (x1 == x2 && x2 == x3)
						return 1L;
					else if (x1 == x2 || x2 == x3 || x3 == x1)
						return 3L;
					else
						return 6L;
				else
					return 0L;
			} else
				return cnt(n, arr1, arr2, 0, x1, x2, true);
		else {
			long tmp = arr2[ind];
			long result = 0L;
			for (long i = 0L; i <= tmp; ++i) {
				arr2[ind] = i;
				if (cntX2)
					result += cnt(n, arr1, arr2, ind+1, x1, x2 * (int)Math.pow(arr1[ind], tmp-i), cntX2);
				else
					result += cnt(n, arr1, arr2, ind+1, x1 * (int)Math.pow(arr1[ind], tmp-i), x2, cntX2);
			}
			return result;
		}
	}
}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class CROC_2013_R2_E
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new CROC_2013_R2_E().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		long n = in.nextLong();
        int cnt = 0;

        if (n % 3 == 0)
        {
            n /= 3;
            ArrayList<Long> f = new ArrayList<Long>();
            long s = (int)Math.sqrt(n);
            for (long i = 1; i <= s; i++)
                if (n % i == 0) f.add(i);

            int t = f.size();
            for (int i = 0; i < t; i++)
                for (int j = i; j < t; j++)
                {
                    long c = n / (f.get(i) * f.get(j));
                    if (f.get(i) * f.get(j) * c == n)
                    {
                        long a = f.get(i), b = f.get(j);
                        if ((a + b + c) % 2 == 1) continue;
                        if (a + b <= c) continue;
                        if (c < b) continue;
                        {
                            if (a == b && b == c)
                                cnt++;
                            else if (a == b || b == c || a == c)
                                cnt += 3;
                            else
                                cnt += 6;
                        }
                    }
                }
        }

		out.println(cnt);
	}

    static boolean IsSquare(long d)
    {
        long x = (long)Math.sqrt(d + 0.1);
        return x * x == d;
    }

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author vadimmm
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {

    private long n, answer;
    private int sqrt2, sqrt3;
    private ArrayList<Long> divisiors;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        n = in.nextLong();
        if (n % 3 != 0) {
            out.println("0");
            return;
        }
        answer = 0;
        n /= 3;
        sqrt2 = 1 + (int) Math.sqrt(n);
        sqrt3 = 1 + (int) Math.pow(n, 1.0 / 3);
        divisiors = new ArrayList<Long>();
        calculate();
        int length = divisiors.size();
        for (int i = 0; i < length && divisiors.get(i) < sqrt3; ++i) {
            long d = n / divisiors.get(i);
            int sqrt = 1 + (int) Math.sqrt(d);
            for (int j = i; j < length && divisiors.get(j) < sqrt; ++j) {
                if (d % divisiors.get(j) == 0) {
                    long c = d / divisiors.get(j);
                    if (c < divisiors.get(i) + divisiors.get(j) && (c + divisiors.get(i) + divisiors.get(j)) % 2 == 0) {
                        if (divisiors.get(i) == c && divisiors.get(j) == c)
                            ++answer;
                        else if (divisiors.get(i) == divisiors.get(j) || divisiors.get(j) == c)
                            answer += 3;
                        else
                            answer += 6;
                    }
                }
            }
        }
        out.println(answer);
    }

    private void calculate() {
        for (int i = 1; i < sqrt2; ++i)
            if (n % i == 0) {
                divisiors.add((long) i);
                long j = n / i;
                if (j != i)
                    divisiors.add(j);
            }
        Collections.sort(divisiors);
    }

}

class InputReader {

    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        stringTokenizer = null;
    }

    public String next() {
        while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

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

    }

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

// CODIGO DE andrewzta, CON MODIFICACION r += 2 POR  r += 3

public class C {
    FastScanner in;
    PrintWriter out;

    public void solve() throws IOException {
        long n = in.nextLong();

        long ans = count(n);
        out.println(ans);
    }

    long count(long n) {
        if (n % 3 != 0) {
            return 0;
        }

        n /= 3;

        long r = 0;
        long maxx = cuberoot(n);

        long[] divs = factor(n);

        for (int i = 0; i < divs.length && divs[i] <= maxx; i++) {
            long x = divs[i];
            long nab = n / x;
            long maxy = sqroot(nab);
            for (int j = i; j < divs.length && divs[j] <= maxy; j++) {
                long y = divs[j];
                if (nab % y != 0) {
                    continue;
                }
                long z = nab / y;

                if ((x + y + z) % 2 != 0) {
                    continue;
                }

                long a = (x + y - z) / 2;
                long b = (x - y + z ) / 2;
                long c = (-x + y + z) / 2;

                if (a > 0 && b > 0 && c > 0 && (a + b) * (a + c) * (b + c) == n) {
//                    System.out.println(a + " " + b + " " + c);
                    if (a == b && a == c) {
                        r++;
                    } else if (a == b || a == c || b == c) {
                        r += 3;
                    } else {
                        r += 6;
                    }
                }
            }
        }

        return r;
    }

    long[] factor(long n) {
        ArrayList<Long> ans = new ArrayList<Long>();
        for (long x = 1; x * x <= n; x++) {
            if (n % x == 0) {
                ans.add(x);
                if (n / x != x) {
                    ans.add(n / x);
                }
            }
        }
        long[] r = new long[ans.size()];
        for (int i = 0; i < ans.size(); i++) {
            r[i] = ans.get(i);
        }
        Arrays.sort(r);
        return r;
    }

    long cuberoot(long n) {
        long l = 0;
        long r = Math.round(Math.sqrt(n));
        while (l < r - 1) {
            long m = (l + r) / 2;
            if (m * m * m <= n) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    long sqroot(long n) {
        long l = 0;
        long r = Math.round(Math.sqrt(n)) + 10;
        while (l < r - 1) {
            long m = (l + r) / 2;
            if (m * m <= n) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    public void run() {
        try {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] arg) {
        new C().run();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) throws IOException {
            br = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                    return "";
                }
            }
            return st.nextToken();
        }

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

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

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class CF293C {

    static long f(long a, long b, long c) {
        return (a*a*b+a*a*c+a*b*b+b*b*c+a*c*c+b*c*c) + 2 * a * b * c;
    }

    static long solve(long n, long d, long u, long v, long w) {
        if (d * d > n) {
            if (n > 1) {
                return solve(1, d, u * n, v, w) + solve(1, d, u, v * n, w) + solve(1, d, u, v, w * n);
            }
            return (u + v + w) % 2 == 0 && u + v > w && u + w > v && v + w > u ? 1 : 0;
        }
        if (n % d == 0) {
            int count = 0;
            while (n % d == 0) {
                count++;
                n /= d;
            }
            long r = 0;
            long u1 = u;
            for (int i = 0; i <= count; ++i) {
                long v1 = v;
                for (int j = 0; i + j <= count; ++j) {
                    long w1 = w;
                    for (int k = 0; i + j + k < count; ++k) {
                        w1 *= d;
                    }
                    r += solve(n, d, u1, v1, w1);
                    v1 *= d;
                }
                u1 *= d;
            }
            return r;
        } else {
            return solve(n, d + 1, u, v, w);
        }
    }

    public static void solve(Input in, PrintWriter out) throws IOException {
//        long ans = 0;
        long n = in.nextLong();
        if (n % 3 != 0) {
            out.println(0);
            return;
        }
        n /= 3;
        long t0 = System.currentTimeMillis();
//        ArrayList<Long> divsL = new ArrayList<Long>();
//        for (long d = 2; d * d <= n; ++d) {
//            if (n % d == 0) {
//                divsL.add(d);
//                if (d * d < n) {
//                    divsL.add(n / d);
//                }
//            }
//        }
//        long[] divs = new long[divsL.size()];
//        for (int i = 0; i < divs.length; ++i) {
//            divs[i] = divsL.get(i);
//        }
//        Arrays.sort(divs);
//        for (int u = 0; u < divs.length; ++u) {
//            int w = divs.length - 1;
//            for (int v = u; v < divs.length; ++v) {
//                while (w >= v && divs[u] * divs[v] > n / divs[w]) {
//                    --w;
//                }
//                if (w < v) {
//                    break;
//                }
//                if ((divs[u] + divs[v] + divs[w]) % 2 == 0 && divs[u] + divs[v] > divs[w] && divs[u] * divs[v] * divs[w] == n) {
////                    System.out.println(divs[u] + " " + divs[v] + " " + divs[w]);
////                    long a = (+ divs[u] + divs[v] - divs[w]) / 2;
////                    long b = (+ divs[u] - divs[v] + divs[w]) / 2;
////                    long c = (- divs[u] + divs[v] + divs[w]) / 2;
////                    System.out.println(a + " " + b + " " + c);
//                    if (u == v && v == w) {
//                        ans++;
//                    } else if (u == v || u == w || v == w) {
//                        ans += 3;
//                    } else {
//                        ans += 6;
//                    }
//                }
//            }
//        }
        out.println(solve(n, 2, 1, 1, 1));
//        for (long a = 1; f(a, a, a) <= n; ++a) {
////            System.out.println(a);
//            for (long b = a; f(a, b, b) <= n; ++b) {
//                long det = (a + b) * (a * a * a - a * a * b - a * b * b + b * b * b + 4 * n);
//                if (det >= 0) {
//                    long d = (long)Math.sqrt(det);
//                    while ((d + 1) * (d + 1) <= det) {
//                        ++d;
//                    }
//                    while (d * d > det) {
//                        --d;
//                    }
//                    if (d * d == det) {
//                        long c = (d - a * a - 2 * a * b - b * b);
//                        if (c >= 0 && c % (2 * (a + b)) == 0) {
//                            c /= 2 * (a + b);
////                            if (f(a, b, c) != n) {
////                                throw new AssertionError();
////                            }
//                            System.out.println(a + " " + b + " " + c);
//                            if (a == b && b == c) {
//                                ans++;
//                            } else if (a == b || a == c || b == c) {
//                                ans += 3;
//                            } else {
//                                ans += 6;
//                            }
//                        }
//                    }
//                }
//            }
//        }
//        System.out.println(maxb + " " + count);
//        System.out.println(System.currentTimeMillis() - t0);
//        out.println(ans);
    }

    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        solve(new Input(new BufferedReader(new InputStreamReader(System.in))), out);
        out.close();
    }

    static class Input {
        BufferedReader in;
        StringTokenizer st;

        public Input(BufferedReader in) {
            this.in = in;
            eat("");
        }

        public Input(String s) {
            this.in = new BufferedReader(new StringReader(s));
        }

        public void eat(String str) {
            st = new StringTokenizer(str);
        }

        public String next() throws IOException {
            while (!st.hasMoreTokens()) {
                String line = in.readLine();
                if (line == null) {
                    return null;
                }
                eat(line);
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

//package croc2013.r2;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class C {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int[] primes = sieveEratosthenes(8000000);
		long n = nl();
		if(n % 3 != 0){
			out.println(0);
		}else{
			n /= 3;
			long[][] f = factor(n, primes);
			long[] ds = divisorsF(f);
			Arrays.sort(ds);
			int ct = 0;
			long cb = (long)Math.cbrt(n)+10;
			for(int i = 0;i < ds.length;i++){
				long d = ds[i];
				if(d > cb)break;
				long u = n/d;
				for(int j = i;j < ds.length && ds[j]*ds[j] <= u;j++){
					long e = ds[j];
					if(n/d%e == 0){
						long q = n/d/e;
						if(((q+d+e)&1) == 0){
							long s = (q+d+e)/2;
							if(s-q > 0 && s-d > 0 && s-e > 0){
								if(d == e){
									if(e == q){
										ct++;
									}else{
										ct += 3;
									}
								}else{
									if(e == q){
										ct += 3;
									}else{
										ct += 6;
									}
								}
							}
						}
					}
				}
			}
			out.println(ct);
		}
	}

	public static long[] divisorsF(long[][] f)
	{
		int n = 1;
		for(int j = 0;j < f.length;j++){
			n *= (int)(f[j][1]+1);
		}
		long[] divs = new long[n];
		int p = 1;
		divs[0] = 1;
		for(int j = 0;j < f.length;j++){
			for(int q = p-1;q >= 0;q--){
				long b = divs[q];
				for(int k = 0;k < f[j][1];k++){
					b *= f[j][0];
//					if((long)b*b <= n)divs[p++] = b;
					divs[p++] = b;
				}
			}
		}
		return divs;
	}

	public static long[][] factor(long n, int[] primes)
	{
		long[][] ret = new long[20][2];
		int rp = 0;
		for(int p : primes){
			if((long)p * p > n)break;
			int i;
			for(i = 0;n % p == 0;n /= p, i++);
			if(i > 0){
				ret[rp][0] = p;
				ret[rp][1] = i;
				rp++;
			}
		}
		if(n != 1){
			ret[rp][0] = n;
			ret[rp][1] = 1;
			rp++;
		}
		return Arrays.copyOf(ret, rp);
	}
	public static int[] sieveEratosthenes(int n) {
		if(n <= 32){
			int[] primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 };
			for(int i = 0;i < primes.length;i++){
				if(n < primes[i]){
					return Arrays.copyOf(primes, i);
				}
			}
			return primes;
		}

		int u = n + 32;
		double lu = Math.log(u);
		int[] ret = new int[(int) (u / lu + u / lu / lu * 1.5)];
		ret[0] = 2;
		int pos = 1;

		int[] isp = new int[(n + 1) / 32 / 2 + 1];
		int sup = (n + 1) / 32 / 2 + 1;

		int[] tprimes = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 };
		for(int tp : tprimes){
			ret[pos++] = tp;
			int[] ptn = new int[tp];
			for(int i = (tp - 3) / 2;i < tp << 5;i += tp)
				ptn[i >> 5] |= 1 << (i & 31);
			for(int i = 0;i < tp;i++){
				for(int j = i;j < sup;j += tp)
					isp[j] |= ptn[i];
			}
		}

		// 3,5,7
		// 2x+3=n
		int[] magic = { 0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4,
				13, 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14 };
		int h = n / 2;
		for(int i = 0;i < sup;i++){
			for(int j = ~isp[i];j != 0;j &= j - 1){
				int pp = i << 5 | magic[(j & -j) * 0x076be629 >>> 27];
				int p = 2 * pp + 3;
				if(p > n)
					break;
				ret[pos++] = p;
				for(int q = pp;q <= h;q += p)
					isp[q >> 5] |= 1 << (q & 31);
			}
		}

		return Arrays.copyOf(ret, pos);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new C().run(); }

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        long M = new Scanner(System.in).nextLong();
        int cnt = 0;

        if (M % 6 == 0) {
            M /= 3;
            long[] divs = new long[1000000];
            int nd = 0;
            for (long i = 2; i * i <= M; i++)
                if (M % i == 0) {
                    long d2 = M / i;
                    divs[nd++] = i;
                    if (d2 != i)
                        divs[nd++] = d2;
                }
            Arrays.sort(divs, 0, nd);

            for (int pi = 0; pi < nd; ++pi) {
                long i = divs[pi];
                if (i * i * i > M) break;

                long M2 = M / i;
                for (int pj = pi; pj < nd; ++pj)
                    if (M2 % divs[pj] == 0) {
                        long j = divs[pj];
                        long k = M2 / j;

                        if (k < j) break;
                        if (i + j > k && (i + j + k) % 2 == 0) {
                            if (i == j && i == k)
                                ++cnt;
                            else if (i == j || i == k || j == k)
                                cnt += 3;
                            else
                                cnt += 6;
                        }

                    }

            }

        }
        System.out.println(cnt);
    }
}

import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.awt.geom.QuadCurve2D;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists())
				System.setIn(new FileInputStream("input.txt"));
		} catch (SecurityException e) {
		}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long time1 = System.currentTimeMillis();
					new Main().run();
					long time2 = System.currentTimeMillis();
					System.err.println("Time " + (time2 - time1) + " ms");
				} catch (Throwable e) {
					e.printStackTrace();
					exit(999);
				}
			}
		}, "1", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	private void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		in.close();
		out.close();
	}

	private void solve() throws IOException {
		long n = nextLong();
		if (n % 3 != 0) {
			out.println(0);
			return;
		}

		n /= 3;

		Set<long[]> set = new TreeSet<long[]>(new Comparator<long[]>() {

			@Override
			public int compare(long[] o1, long[] o2) {
				for (int i = 0; i < o1.length; i++)
					if (o1[i] != o2[i])
						return o1[i] < o2[i] ? -1 : 1;
				return 0;
			}
		});

		for (long x = 1L; x * x * x <= n; x++) {
			if (n % x != 0)
				continue;
			long m = n / x;
			for (long a = 1; 2 * a < x; a++) {
				double[] w = new double[3];
				long b = x - a;
				w[0] = a * b - m;
				w[1] = a + b;
				w[2] = 1;
				int sl = QuadCurve2D.solveQuadratic(w);
				for (int i = 0; i < sl; i++) {
					long c = (long)(w[i] + 0.001);
					if (c > 0 && (a + c) * (b + c) == m) {
						long[] q = new long[] { a, b, c };
						sort(q);
						set.add(q);
					}
				}
			}
		}

		long[] f = {1, 1, 3, 6};

		long ans = 0;
		for (long[] t : set) {
			int count = 1;
			if (t[0] != t[1])
				count++;
			if (t[1] != t[2])
				count++;
			ans += f[count];
		}

//		System.err.println(set.size());
//		System.err.println(ans / 39090.);

		out.println(ans);
	}

	long pw3(long a) {
		return a * a * a;
	}

	class T implements Comparable<T> {
		long a, b, c;

		public T(long... x) {
			sort(x);
			this.a = x[0];
			this.b = x[1];
			this.c = x[2];
		}

		@Override
		public int compareTo(T t) {
			int cmp1 = Long.compare(a, t.a);
			if (cmp1 != 0)
				return cmp1;
			int cmp2 = Long.compare(b, t.b);
			if (cmp2 != 0)
				return cmp2;
			return Long.compare(c, t.c);
		}

	}

	void chk(boolean b) {
		if (b)
			return;
		System.out.println(new Error().getStackTrace()[1]);
		exit(999);
	}
	void deb(String fmt, Object... args) {
		System.out.printf(Locale.US, fmt + "%n", args);
	}
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {

	long n;

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		n = in.nextLong();
		if (n % 3 != 0) {
			out.println(0);
			return;
		}
		n /= 3;
		int ans = 0;
		for (long ab = 2; ab * ab * ab <= n; ++ab) {
			if (n % ab != 0) {
				continue;
			}
			long left = n / ab;
			long to = (long) Math.sqrt(left);
			for (long a = 0; a <= ab / 2; ++a) {
				long b = ab - a;
				long A = 1;
				long B = ab;
				long C = a * b - left;
				long discr = B * B - 4 * A * C;
				if (discr < 0) {
					continue;
				}
				long root = (long) Math.sqrt(discr);
				if (root * root < discr) {
					++root;
				}
				if (root * root != discr) {
					continue;
				}
				long c = (-B + root) / 2 / A;
				if (c >= b) {
					long mult = (a + c) * (b + c);
					if (mult == left) {
						int cur = 1;
						if (b > a) {
							cur *= 2;
							if (c > b) {
								cur *= 3;
							}
						} else if (c > b) {
							cur *= 2;
						}
						ans += cur;
					}
				}
			}
		}
		out.println(ans);
	}
}

class InputReader {
	private final BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = new StringTokenizer("");
	}

	public String next() {
		while (!tokenizer.hasMoreTokens()) {
			try {
				String line = reader.readLine();
				if (line == null) {
					return null;
				}
				tokenizer = new StringTokenizer(line);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return tokenizer.nextToken();
	}

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

	}

class OutputWriter extends PrintWriter {

	public OutputWriter(Writer out) {
		super(out);
	}

	public OutputWriter(OutputStream out) {
		super(out);
	}

	}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {

	long n;

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		n = in.nextLong();
		if (n % 3 != 0) {
			out.println(0);
			return;
		}
		n /= 3;
		int ans = 0;
		for (long ab = 2; ab * ab * ab <= n; ++ab) {
			if (n % ab != 0) {
				continue;
			}
			long left = n / ab;
			long to = (long) Math.sqrt(left);
			for (long a = 1; a <= ab / 2; ++a) {
				long b = ab - a;
				long A = 1;
				long B = ab;
				long C = a * b - left;
				long discr = B * B - 4 * A * C;
				if (discr < 0) {
					continue;
				}
				long root = (long) Math.sqrt(discr);
				if (root * root < discr) {
					++root;
				}
				if (root * root != discr) {
					continue;
				}
				long c = (-B + root) / 2 / A;
				if (c >= b) {
					long mult = (a + c) * (b + c);
					if (mult == left) {
						int cur = 1;
						if (b > a) {
							cur *= 2;
							if (c > b) {
								cur *= 3;
							}
						} else if (c > b) {
							cur *= 2;
						}
						ans += cur;
					}
				}
			}
		}
		out.println(ans);
	}
}

class InputReader {
	private final BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = new StringTokenizer("");
	}

	public String next() {
		while (!tokenizer.hasMoreTokens()) {
			try {
				String line = reader.readLine();
				if (line == null) {
					return null;
				}
				tokenizer = new StringTokenizer(line);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return tokenizer.nextToken();
	}

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

	}

class OutputWriter extends PrintWriter {

	public OutputWriter(Writer out) {
		super(out);
	}

	public OutputWriter(OutputStream out) {
		super(out);
	}

	}

import java.io.*;

import static java.lang.Math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) {
		if(new File("input.txt").exists())
			try {
				System.setIn(new FileInputStream("input.txt"));
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "kek", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Locale.setDefault(Locale.US);
//		long t = System.currentTimeMillis();
		solve();
//		System.err.println(System.currentTimeMillis() - t);
		in.close();
		out.close();
	}

	long prev[];

	void solve() throws IOException{
		long r = nextLong();
		if(r % 3 != 0) {
			out.println(0);
			return;
		}
		long n = r / 3;
		long ans = 0;
		for(long x = 1; x * x * x < n; x++){
			if(n % x == 0){
				for(long a = 1; a <= x / 2 ; a++){
					long b = x - a;
					long f = a + b;
					long e = a * b - n / (a + b);
					long D = f * f - 4 * e;
					double z = sqrt(D);
					z = (-f + z) / 2;
					long c = Math.round(z);
					if(c <= 0 || (a + b) > (a + c) || (a + b) > (b + c) || (a + c) > (b + c)) continue;

					if( (a + b) * (a + c) * (b + c) == n){
						int k = 0;
						if(a != b) k++;
						if(a != c) k++;
						if(b != c) k++;
						if(k == 0)
							ans += 1;
						if(k == 2){
							ans += 3;
						}
						if(k == 3){
							ans += 6;
						}
					}
				}
			}
		}
		out.println(ans);
	}

	String nextToken() throws IOException{
		while(!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	long nextLong() throws IOException{
		return Long.parseLong(nextToken());
	}
	int nextInt() throws IOException{
		return Integer.parseInt(nextToken());
	}
	double nextDouble() throws IOException{
		return Double.parseDouble(nextToken());
	}
}

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.sort;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		long n = nextLong();
		if (n % 3 != 0) {
			out.print(0);
			return;
		}
		n /= 3;
		long divisors[] = new long[4096];
		int divCnt = 0;
		for (int i = 1; (long) i * i <= n; i++) {
			if (n % i != 0) {
				continue;
			}
			if (divCnt + 1 >= divisors.length) {
				divisors = copyOf(divisors, divisors.length << 1);
			}
			divisors[divCnt++] = i;
			if ((long) i * i < n) {
				divisors[divCnt++] = n / i;
			}
		}
		sort(divisors, 0, divCnt);
		int ans = 0;
		for (int i = 0; i < divCnt; i++) {
			long dI = divisors[i];
			long qI = n / dI;
			for (int j = i; j < divCnt; j++) {
				long dJ = divisors[j];
				if (qI % dJ != 0) {
					continue;
				}
				long qJ = qI / dJ;
				if (qJ < dJ) {
					break;
				}
				long sum = dI + dJ + qJ;
				if ((sum & 1) != 0) {
					continue;
				}
				sum >>= 1;
				long a = sum - dI;
				long b = sum - dJ;
				long c = sum - qJ;
				if ((a | b | c) < 0) {
					continue;
				}
				if (a == b) {
					if (b == c) {
						++ans;
					} else {
						ans += 3;
					}
				} else {
					if (b == c) {
						ans += 3;
					} else {
						ans += 6;
					}
				}
			}
		}
		out.print(ans);
	}

	static int nextInt() throws IOException {
		return parseInt(next());
	}

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.*;

public class C2 {

    private static long n;
    private static Map<Long, Integer> primes;
    private static List<Long> primesList;
    private static List<Triple> aL = new ArrayList<Triple>();

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        n = in.nextLong();
        if (n % 3 != 0) out.print(0);
        else {
            primes = new HashMap<Long, Integer>();
            n /= 3;
            Long t = n;
            for (long i = 2; i <= Math.sqrt(t); i++) {
                if (t % i == 0) {
                    if (primes.get(i) == null) primes.put(i, 0);
                    primes.put(i, primes.get(i) + 1);
                    t /= i;
                    i--;
                }
            }
            if (primes.get(t) == null) primes.put(t, 0);
            primes.put(t, primes.get(t) + 1);

            primesList = new ArrayList<Long>(primes.keySet());

            Map<Long, Integer> counts = new HashMap<Long, Integer>();
            for (Long integer : primes.keySet()) {
                counts.put(integer, 0);
            }

            out.println(calc(0, 1, counts));

//            Collections.sort(aL, new Comparator<Triple>() {
//                @Override
//                public int compare(Triple o1, Triple o2) {
//                    final int i = (int) (o1.a - o2.a);
//                    return i != 0 ? i : (int) (o1.b - o2.b);
//                }
//            });
//
//            for (int i = 0; i < aL.size(); i++) {
//                out.println(aL.get(i));
//            }
        }

        out.close();
    }

    private static int calc(int i, long k, Map<Long, Integer> counts) {
        if (i == primesList.size()) {
            int ans = 0;
            if (k != 1) {
                for (int a = 1; a <= k / 2; a++) {
                    long d = k * k - (4 * (a * (k - a) - n / k));
                    long kD = (long) Math.floor(Math.sqrt(d));
                    if (d > 0 && kD * kD == d && kD - k > 0 && (kD - k) % 2 == 0) {
                        final long b = k - a;
                        final long c = (kD - k) / 2;
//                        aL.add(new Triple(a, b , c));
                        if (b <= c) {
                            ans += count(a, b, c);
                        }
                    }
                }
            }
            return ans;
        }
        int ans = 0;
        long prime = primesList.get(i);
        int count = primes.get(prime);
        long t = 1;
        counts.put(prime, 0);
        while (counts.get(prime) <= count) {
            if (k * t > Math.pow(n, 1d / 3)) {
                break;
            }
            ans += calc(i + 1, k * t, counts);
            counts.put(prime, counts.get(prime) + 1);
            t *= prime;
        }
        return ans;
    }

    private static int count(long a, long b, long c) {
        if (a == b && a == c) return 1;
        if (a != b && a != c) return 6;
        return 3;
    }

    private static class Triple {
        private final long a;
        private final long b;
        private final long c;

        private Triple(long a, long b, long c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        @Override
        public String toString() {
            return a + " " + b + " " + c;
        }
    }

}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.*;

public class C2 {

    private static long n;
    private static Map<Long, Integer> primes;
    private static List<Long> primesList;
    private static List<Triple> aL = new ArrayList<Triple>();

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        n = in.nextLong();
        if (n % 3 != 0) out.print(0);
        else {
            primes = new HashMap<Long, Integer>();
            n /= 3;
            long t = n;
            for (long i = 2; i * i <= t; i++) {
                if (t % i == 0) {
                    if (primes.get(i) == null) primes.put(i, 0);
                    primes.put(i, primes.get(i) + 1);
                    t /= i;
                    i--;
                }
            }
            if (primes.get(t) == null) primes.put(t, 0);
            primes.put(t, primes.get(t) + 1);

            primesList = new ArrayList<Long>(primes.keySet());

            Map<Long, Integer> counts = new HashMap<Long, Integer>();
            for (Long integer : primes.keySet()) {
                counts.put(integer, 0);
            }

            out.println(calc(0, 1, counts));

//            Collections.sort(aL, new Comparator<Triple>() {
//                @Override
//                public int compare(Triple o1, Triple o2) {
//                    final int i = (int) (o1.a - o2.a);
//                    return i != 0 ? i : (int) (o1.b - o2.b);
//                }
//            });
//
//            for (int i = 0; i < aL.size(); i++) {
//                out.println(aL.get(i));
//            }
        }

        out.close();
    }

    private static int calc(int i, long k, Map<Long, Integer> counts) {
        if (i == primesList.size()) {
            int ans = 0;
            if (k != 1) {
                for (int a = 1; a <= k / 2; a++) {
                    long d = k * k - (4 * (a * (k - a) - n / k));
                    long kD = (long) Math.floor(Math.sqrt(d));
                    if (d > 0 && kD * kD == d && kD - k > 0 && (kD - k) % 2 == 0) {
                        final long b = k - a;
                        final long c = (kD - k) / 2;
//                        aL.add(new Triple(a, b , c));
                        if (b <= c) {
                            ans += count(a, b, c);
                        }
                    }
                }
            }
            return ans;
        }
        int ans = 0;
        long prime = primesList.get(i);
        int count = primes.get(prime);
        long t = 1;
        counts.put(prime, 0);
        while (counts.get(prime) <= count) {
            final long tK = k * t;
            if (tK * tK * tK > n) {
                break;
            }
            ans += calc(i + 1, tK, counts);
            counts.put(prime, counts.get(prime) + 1);
            t *= prime;
        }
        return ans;
    }

    private static int count(long a, long b, long c) {
        if (a == b && a == c) return 1;
        if (a != b && a != c) return 6;
        return 3;
    }

    private static class Triple {
        private final long a;
        private final long b;
        private final long c;

        private Triple(long a, long b, long c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        @Override
        public String toString() {
            return a + " " + b + " " + c;
        }
    }

}

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

public class SolC {
    public static void main(String[] args) {
        new SolC().run();
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;
    boolean eof = false;
    Random rand = new Random(3267347);

    private void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(566);
        }
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(nextToken());
    }

    long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    long MAGIC = 40000;
    long ans = 0;

    void check(long a, long b, long c, long n) {
        if (a % 2 != 0) return;
        a /= 2;
        if (a < b) return;
        if (a < 1 || b < 1 || c < 1) return;
        long t = (b + c) * (a * a + a * (b + c) + b * c);
        if (n == t) {
            int add = 1;
            if (a != b) {
                if (b != c) {
                    add *= 6;
                } else {
                    add *= 2;
                }
            } else if (a != c) {
                add *= 2;
            }
            ans += add;
        }
    }

    private void solve() throws IOException {
        long n = nextLong();
        if (n % 3 != 0) {
            out.println(0);
            return;
        }
        n /= 3;
//      int cnt = 0;
//      long max = 0;
        for (long bc = 1; bc <= 2 * MAGIC; bc++) {
            if (n % bc != 0) {
                continue;
            }
            long bc2 = bc * bc;
            long t = n / bc;
            for (long b = bc / 2; b < bc; b++) {
                long c = bc - b;
                if (c > b) continue;
                long d = bc2 - 4 * (b * c - t);
//              if (d % 2 == 0 && d % 4 != 0) continue;
//              if (d % 3 == 0 && d % 9 != 0) continue;
                long dd = Math.round(Math.sqrt(d));
                if (dd * dd != d) {
                    continue;
                }
//              cnt++;
//              max = Math.max(dd, max);
                long a1 = (-bc - dd);
                long a2 = (-bc + dd);
                check(a1, b, c, n);
                check(a2, b, c, n);
//              if (a1 % 2 == 0 && a1 >= b && a1 >= c) {
//                  ans++;
//              }
//              if (a2 % 2 == 0 && a2 >= b && a2 >= c) {
//                  ans++;
//              }
            }
        }
//      System.err.println(cnt);
//      System.err.println(max);
        out.println(ans);
    }
}

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

public class C {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		long n = nextLong();
		if (n % 3 != 0) {
			out.println(0);
			return;
		}

		n /= 3;

		ArrayList<Long> divAL = new ArrayList<>();
		for (long i = 1; i * i <= n; i++) {
			if (n % i == 0) {
				divAL.add(i);
				if (i * i != n)
					divAL.add(n / i);
			}
		}

		Collections.sort(divAL);

		long[] div = new long[divAL.size()];
		for (int i = 0; i < div.length; i++)
			div[i] = divAL.get(i);

		int ans = 0;
		for (int bigInd = 0; bigInd < div.length; bigInd++) {
			long big = div[bigInd];
			long rest = n / big;

			for (int smallInd = 0; smallInd <= bigInd; smallInd++) {
				long small = div[smallInd];
				if (small * small > rest)
					break;
				if (rest % small != 0)
					continue;
				long mid = rest / small;
				if (mid <= big && small + mid >= big) {
					if (((big ^ mid ^ small) & 1) == 0) {

						if (big == mid && mid == small)
							ans++;
						else if (big == mid || mid == small)
							ans += 3;
						else
							ans += 6;

					}
				}
			}
		}
		out.println(ans);
	}

	C() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new C();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {
    FastScanner in;
    PrintWriter out;

    public void solve() throws IOException {
        long n = in.nextLong();

        long ans = count(n);
        out.println(ans);
    }

    long count(long n) {
        if (n % 3 != 0) {
            return 0;
        }

        n /= 3;

        long r = 0;
        long maxx = cuberoot(n);

        long[] divs = factor(n);

        for (int i = 0; i < divs.length && divs[i] <= maxx; i++) {
            long x = divs[i];
            long nab = n / x;
            long maxy = sqroot(nab);
            for (int j = i; j < divs.length && divs[j] <= maxy; j++) {
                long y = divs[j];
                if (nab % y != 0) {
                    continue;
                }
                long z = nab / y;

                if ((x + y + z) % 2 != 0) {
                    continue;
                }

                long a = (x + y - z) / 2;
                long b = (x - y + z ) / 2;
                long c = (-x + y + z) / 2;

                if (a > 0 && b > 0 && c > 0 && (a + b) * (a + c) * (b + c) == n) {
//                    System.out.println(a + " " + b + " " + c);
                    if (a == b && a == c) {
                        r++;
                    } else if (a == b || a == c || b == c) {
                        r += 0;
                    } else {
                        r += 6;
                    }
                }
            }
        }

        return r;
    }

    long[] factor(long n) {
        ArrayList<Long> ans = new ArrayList<Long>();
        for (long x = 1; x * x <= n; x++) {
            if (n % x == 0) {
                ans.add(x);
                if (n / x != x) {
                    ans.add(n / x);
                }
            }
        }
        long[] r = new long[ans.size()];
        for (int i = 0; i < ans.size(); i++) {
            r[i] = ans.get(i);
        }
        Arrays.sort(r);
        return r;
    }

    long cuberoot(long n) {
        long l = 0;
        long r = Math.round(Math.sqrt(n));
        while (l < r - 1) {
            long m = (l + r) / 2;
            if (m * m * m <= n) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    long sqroot(long n) {
        long l = 0;
        long r = Math.round(Math.sqrt(n)) + 10;
        while (l < r - 1) {
            long m = (l + r) / 2;
            if (m * m <= n) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    public void run() {
        try {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] arg) {
        new C().run();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) throws IOException {
            br = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                    return "";
                }
            }
            return st.nextToken();
        }

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

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

import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class E {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		long input = sc.nextLong();

		long tmp1 = 2L;
		long tmp2 = input/3;
		long cnt = 0L;
		List<Long> arr1 = new LinkedList<Long>();
		List<Long> arr2 = new LinkedList<Long>();

		while (tmp2 > 1) {
			if (tmp2 % tmp1 == 0L) {
				++cnt;
				tmp2 /= tmp1;
			}
			else {
				if (cnt != 0L) {
					arr1.add(tmp1);
					arr2.add(cnt);
					cnt = 0L;
				}
				++tmp1;
			}
		}
		if (cnt != 0L) {
			arr1.add(tmp1);
			arr2.add(cnt);
		}

		System.out.println(
							cnt(	input/3, arr1.toArray(new Long[0]), arr2.toArray(new Long[0]),
									0, 1, 1, false));
	}

	private static long cnt (long n, Long[] arr1, Long[] arr2, int ind,
							long x1, long x2, boolean cntX2) {
		if (ind == arr1.length)
			if (cntX2) {
				long x3 = n / x1 / x2;
				if (x1 >= x2 && x2 >= x3 && x3 + x2 > x1 && (x1+x2+x3)%2 == 0)
					if (x1 == x2 && x2 == x3)
						return 1L;
					else if (x1 == x2 || x2 == x3 || x3 == x1)
						return 3L;
					else
						return 6L;
				else
					return 0L;
			} else
				return cnt(n, arr1, arr2, 0, x1, x2, true);
		else {
			long tmp = arr2[ind];
			long result = 0L;
			for (long i = 0L; i <= tmp; ++i) {
				arr2[ind] = i;
				if (cntX2)
					result += cnt(n, arr1, arr2, ind+1, x1, x2 * (int)Math.pow(arr1[ind], tmp-i), cntX2);
				else
					result += cnt(n, arr1, arr2, ind+1, x1 * (int)Math.pow(arr1[ind], tmp-i), x2, cntX2);
			}
			return result;
		}
	}
}

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

// CODIGO DE andrewzta, CON MODIFICACION r += 2 POR  r += 3

public class C {
    FastScanner in;
    PrintWriter out;

    public void solve() throws IOException {
        long n = in.nextLong();

        long ans = count(n);
        out.println(ans);
    }

    long count(long n) {
        if (n % 3 != 0) {
            return 0;
        }

        n /= 3;

        long r = 0;
        long maxx = cuberoot(n);

        long[] divs = factor(n);

        for (int i = 0; i < divs.length && divs[i] <= maxx; i++) {
            long x = divs[i];
            long nab = n / x;
            long maxy = sqroot(nab);
            for (int j = i; j < divs.length && divs[j] <= maxy; j++) {
                long y = divs[j];
                if (nab % y != 0) {
                    continue;
                }
                long z = nab / y;

                if ((x + y + z) % 2 != 0) {
                    continue;
                }

                long a = (x + y - z) / 2;
                long b = (x - y + z ) / 2;
                long c = (-x + y + z) / 2;

                if (a > 0 && b > 0 && c > 0 && (a + b) * (a + c) * (b + c) == n) {
//                    System.out.println(a + " " + b + " " + c);
                    if (a == b && a == c) {
                        r++;
                    } else if (a == b || a == c || b == c) {
                        r += 2;
                    } else {
                        r += 6;
                    }
                }
            }
        }

        return r;
    }

    long[] factor(long n) {
        ArrayList<Long> ans = new ArrayList<Long>();
        for (long x = 1; x * x <= n; x++) {
            if (n % x == 0) {
                ans.add(x);
                if (n / x != x) {
                    ans.add(n / x);
                }
            }
        }
        long[] r = new long[ans.size()];
        for (int i = 0; i < ans.size(); i++) {
            r[i] = ans.get(i);
        }
        Arrays.sort(r);
        return r;
    }

    long cuberoot(long n) {
        long l = 0;
        long r = Math.round(Math.sqrt(n));
        while (l < r - 1) {
            long m = (l + r) / 2;
            if (m * m * m <= n) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    long sqroot(long n) {
        long l = 0;
        long r = Math.round(Math.sqrt(n)) + 10;
        while (l < r - 1) {
            long m = (l + r) / 2;
            if (m * m <= n) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    public void run() {
        try {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] arg) {
        new C().run();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) throws IOException {
            br = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                    return "";
                }
            }
            return st.nextToken();
        }

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

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

import java.util.*;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if(n % 3 != 0)
			System.out.println(0);
		else {
			int count = 0;
			n = n/3;
			Vector<Long> vc = new Vector<Long>();
			for(long x = 2; x * x <= n; x++) {
				if(n % x == 0) {
					vc.addElement(x);
				}
			}
			long thres = (long) Math.pow(n, 1.0/3);
			for(int i = 0; vc.elementAt(i) < thres; i++) {
				long x = vc.elementAt(i);
				long t = n / x;
				for(int j = i; vc.elementAt(j) * vc.elementAt(j) <= t; j++)
					if(t % vc.elementAt(j) == 0) {
						long y = vc.elementAt(j);
						long z = t / y;
						if(x + y > z && (x + y + z) % 2 == 0) {
							if(x == y && y == z)
								count++;
							else if(x == y || y == z)
								count += 3;
							else
								count += 6;
						}
					}
			}
			System.out.println(count);
		}
	}

}

import java.util.*;

public class Main {

	private static int search(long[] a, long key) {
		int lo = 0, hi = a.length - 1;
		while(lo < hi) {
			int mid = (lo + hi)/2;
			if(a[mid] > key)
				hi = mid - 1;
			else if(a[mid] < key)
				lo = mid + 1;
			else return mid;
		}
		return lo;
	}
	@SuppressWarnings("resource")
	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if(n % 3 != 0)
			System.out.println(0);
		else {
			int count = 0, size = 0;
			n = n/3;
			Vector<Long> vc = new Vector<Long>();
			for(long x = 2; x * x <= n; x++) {
				if(n % x == 0) {
					vc.addElement(x);
					size++;
				}
			}
			long[] a = new long[size];
			for(int i = 0; i < size; i++) {
				a[i] = vc.elementAt(i);
			}
			long thres = (long) Math.pow(n, 1.0/3);
			int m = search(a, thres);
			for(int i = 0; i <= m; i++) {
				long x = a[i];
				long t = n / x;
				int k = search(a, (long) Math.pow(t, 0.5));
				for(int j = i; j <= k; j++) {
					if(t % a[j] == 0) {
						long y = a[j];
						long z = t / y;
						if(x + y > z && (x + y + z) % 2 == 0) {
							if(x == y && y == z)
								count++;
							else if(x == y || y == z)
								count += 3;
							else
								count += 6;
						}
					}
				}
			}
			System.out.println(count);
		}
	}

}

import java.util.*;

public class Main {

	private static int search(long[] a, long key) {
		int lo = 0, hi = a.length - 1;
		while(lo < hi) {
			int mid = (lo + hi)/2;
			if(a[mid] > key)
				hi = mid - 1;
			else if(a[mid] < key)
				lo = mid + 1;
			else return mid;
		}
		return lo;
	}
	@SuppressWarnings("resource")
	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if(n % 3 != 0)
			System.out.println(0);
		else {
			int count = 0, size = 0;
			n = n/3;
			Vector<Long> vc = new Vector<Long>();
			for(long x = 2; x * x <= n; x++) {
				if(n % x == 0) {
					vc.addElement(x);
					size++;
				}
			}
			if(size == 0)
				System.out.println(0);
			else {
				long[] a = new long[size];
				for(int i = 0; i < size; i++) {
					a[i] = vc.elementAt(i);
				}
				long thres = (long) Math.pow(n, 1.0/3);
				int m = search(a, thres);
				for(int i = 0; i <= m; i++) {
					long x = a[i];
					long t = n / x;
					int k = search(a, (long) Math.pow(t, 0.5));
					for(int j = i; j <= k; j++) {
						if(t % a[j] == 0) {
							long y = a[j];
							long z = t / y;
							if(x + y > z && (x + y + z) % 2 == 0) {
								if(x == y && y == z)
									count++;
								else if(x == y || y == z)
									count += 3;
								else if( x < y && y < z)
									count += 6;
							}
						}
					}
				}
				System.out.println(count);
			}
		}
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        long M = new Scanner(System.in).nextLong();
        int cnt = 0;

        if (M % 6 == 0) {
            M /= 3;
            long[] divs = new long[1000000];
            int nd = 0;
            for (long i = 2; i * i <= M; i++)
                if (M % i == 0) {
                    long d2 = M / i;
                    divs[nd++] = i;
                    if (d2 != i)
                        divs[nd++] = d2;
                }
            Arrays.sort(divs, 0, nd);

            for (int pi = 0; pi < nd; ++pi) {
                long i = divs[pi];
                if (i * i * i > M) break;

                long M2 = M / i;
                for (int pj = pi; pj < nd; ++pj)
                    if (M2 % divs[pj] == 0) {
                        long j = divs[pj];
                        long k = M2 / j;

                        if (k < j) break;
                        if (i + j > k && (i + j + k) % 2 == 0) {
                            if (i == j && i == k)
                                ++cnt;
                            else if (i == j || i == k || j == k)
                                cnt += 3;
                            else
                                cnt += 6;
                        }

                    }

            }

            System.out.println(cnt);
        }
    }
}