import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;

public class Euler257 {
    static long floorSqrt(long x) {
        long r = (long) Math.sqrt(x);
        while ((r + 1) * (r + 1) <= x)
            r++;
        while (r * r > x)
            r--;
        return r;
    }

    static long ceilSqrt(long x) {
        long r = floorSqrt(x);
        return (r * r == x) ? r : (r + 1);
    }

    static long gcd(long a, long b) {
        while (b != 0) {
            long t = b;
            b = a % b;
            a = t;
        }
        return a;
    }

    static long countCaseK2A(long yStart, long yEnd, long limit) {
        long count = 0;
        for (long y = yStart; y < yEnd; ++y) {
            long xMax = floorSqrt(2 * y * y);
            for (long x = y + 1; x <= xMax; ++x) {
                if ((x & 1) == 0 || gcd(x, y) != 1)
                    continue;
                long base = (x + y) * (x + 2 * y);
                if (base > limit)
                    continue;
                count += limit / base;
            }
        }
        return count;
    }

    static long countCaseK2B(long xStart, long xEnd, long limit) {
        long count = 0;
        for (long x = xStart; x < xEnd; ++x) {
            long yMin = ceilSqrt(2 * x * x);
            long yMax = 2 * x - 1;
            for (long y = yMin; y <= yMax; ++y) {
                if ((y & 1) == 0 || gcd(x, y) != 1)
                    continue;
                long base = (x + y) * (2 * x + y);
                if (base > limit)
                    continue;
                count += limit / base;
            }
        }
        return count;
    }

    static long countCaseK3A(long yStart, long yEnd, long limit) {
        long count = 0;
        for (long y = yStart; y < yEnd; ++y) {
            long xMax = floorSqrt(3 * y * y);
            for (long x = y + 1; x <= xMax; ++x) {
                if (x % 3 == 0 || gcd(x, y) != 1)
                    continue;
                long baseNum = (x + y) * (x + 3 * y);
                if (baseNum > 2 * limit)
                    continue;

                long gMax = (2 * limit) / baseNum;
                boolean oddGValid = ((x * (x + y)) % 2 == 0) && ((y * (x + 3 * y)) % 2 == 0);
                count += oddGValid ? gMax : (gMax / 2);
            }
        }
        return count;
    }

    static long countCaseK3B(long xStart, long xEnd, long limit) {
        long count = 0;
        for (long x = xStart; x < xEnd; ++x) {
            long yMin = ceilSqrt(3 * x * x);
            long yMax = 3 * x - 1;
            for (long y = yMin; y <= yMax; ++y) {
                if (y % 3 == 0 || gcd(x, y) != 1)
                    continue;
                long baseNum = (x + y) * (3 * x + y);
                if (baseNum > 2 * limit)
                    continue;

                long gMax = (2 * limit) / baseNum;
                boolean oddGValid = ((x * (y + 3 * x)) % 2 == 0) && ((y * (x + y)) % 2 == 0);
                count += oddGValid ? gMax : (gMax / 2);
            }
        }
        return count;
    }

    public static String solve() {
        long limit = 100000000L;
        long maxVar = floorSqrt(limit) + 2;
        long count = limit / 3;

        int threads = Math.max(1, Runtime.getRuntime().availableProcessors());
        ExecutorService executor = Executors.newFixedThreadPool(threads);
        List<Future<Long>> futures = new ArrayList<>();

        long chunk = (maxVar + threads - 1) / threads;

        for (int t = 0; t < threads; ++t) {
            long start = 1 + t * chunk;
            long end = Math.min(maxVar + 1, 1 + (t + 1) * chunk);
            if (start < end) {
                futures.add(executor.submit(() -> countCaseK2A(start, end, limit)));
                futures.add(executor.submit(() -> countCaseK2B(start, end, limit)));
                futures.add(executor.submit(() -> countCaseK3A(start, end, limit)));
                futures.add(executor.submit(() -> countCaseK3B(start, end, limit)));
            }
        }

        for (Future<Long> f : futures) {
            try {
                count += f.get();
            } catch (Exception e) {
            }
        }
        executor.shutdown();

        return String.valueOf(count);
    }

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