import java.math.BigInteger;
import java.util.*;

public class Euler582 {
    static class Sol implements Comparable<Sol> {
        long X, n;

        Sol(long X, long n) {
            this.X = X;
            this.n = n;
        }

        public int compareTo(Sol o) {
            if (this.X != o.X)
                return Long.compare(this.X, o.X);
            return Long.compare(this.n, o.n);
        }

        public boolean equals(Object obj) {
            if (!(obj instanceof Sol))
                return false;
            Sol o = (Sol) obj;
            return this.X == o.X && this.n == o.n;
        }

        public int hashCode() {
            return Objects.hash(X, n);
        }
    }

    static class Tri {
        BigInteger a, b, c;

        Tri(BigInteger a, BigInteger b, BigInteger c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        public boolean equals(Object obj) {
            if (!(obj instanceof Tri))
                return false;
            Tri o = (Tri) obj;
            return a.equals(o.a) && b.equals(o.b) && c.equals(o.c);
        }

        public int hashCode() {
            return Objects.hash(a, b, c);
        }
    }

    static Sol reduce_solution(long X, long n) {
        while (true) {
            long Xp = 2 * X - 3 * n;
            long np = -X + 2 * n;
            if (Xp <= 0 || np <= 0)
                break;
            X = Xp;
            n = np;
        }
        return new Sol(X, n);
    }

    static List<Sol> fundamental_solutions(int S) {
        Set<Sol> reps = new TreeSet<>();
        for (long n = 1; n <= 500; ++n) {
            long v = 3 * n * n + S;
            if (v <= 0)
                continue;
            long x = Math.round(Math.sqrt(v));
            for (long X = Math.max(1, x - 2); X <= x + 2; ++X) {
                if (X * X == v) {
                    reps.add(reduce_solution(X, n));
                }
            }
        }
        return new ArrayList<>(reps);
    }

    public static String solve() {
        BigInteger N = BigInteger.TEN.pow(100);
        Set<Tri> uniq = new HashSet<>();
        Map<Integer, List<Sol>> cache = new HashMap<>();

        for (int S = -100; S <= 100; ++S) {
            if (S == 0)
                continue;
            int diff = Math.abs(S);
            int kmax = 100 / diff;
            if (kmax == 0)
                continue;

            if (!cache.containsKey(S)) {
                cache.put(S, fundamental_solutions(S));
            }

            for (Sol rep : cache.get(S)) {
                BigInteger X = BigInteger.valueOf(rep.X);
                BigInteger n = BigInteger.valueOf(rep.n);

                while (true) {
                    BigInteger m = n.add(X);
                    BigInteger A = m.multiply(m).subtract(n.multiply(n));
                    BigInteger B = m.multiply(n).multiply(BigInteger.valueOf(2)).add(n.multiply(n));
                    BigInteger C = m.multiply(m).add(m.multiply(n)).add(n.multiply(n));

                    if (C.compareTo(N) > 0)
                        break;

                    BigInteger a0 = A.min(B);
                    BigInteger b0 = A.max(B);

                    for (int k = 1; k <= kmax; ++k) {
                        BigInteger kk = BigInteger.valueOf(k);
                        BigInteger c = kk.multiply(C);
                        if (c.compareTo(N) > 0)
                            break;
                        uniq.add(new Tri(kk.multiply(a0), kk.multiply(b0), c));
                    }

                    BigInteger Xnxt = X.multiply(BigInteger.valueOf(2)).add(n.multiply(BigInteger.valueOf(3)));
                    BigInteger nnxt = X.add(n.multiply(BigInteger.valueOf(2)));
                    X = Xnxt;
                    n = nnxt;
                }
            }
        }
        return Integer.toString(uniq.size());
    }

    public static void main(String[] args) {
        System.out.println(solve());
    }
}
