#include <iostream>
#include <cmath>

int findTriples(int n) {
    int count = 0;

    for (int a = 1; a <= n; ++a) {
        for (int b = a; b <= n; ++b) { // b >= a, aby uniknąć duplikatów {a, b}
            int maxH = std::sqrt(n * n - a * a - b * b); // Maksymalny h, który spełnia warunek
            for (int h = 1; h <= maxH; ++h) {
                int sumSquares = a * a + b * b + h * h;
                int sqrtValue = static_cast<int>(std::sqrt(sumSquares));
                if (sqrtValue * sqrtValue == sumSquares && sqrtValue <= n) { // Sprawdzenie całkowitego pierwiastka
                   /* std::cout << "(a, b, h) = (" << a << ", " << b << ", " << h << ") => sqrt("
                        << sumSquares << ") = " << sqrtValue << std::endl;*/
                    count++;
                }
            }
        }
    }

    /*std::cout << "Liczba unikalnych trojek (a, b, h), dla ktorych sqrt(a^2 + b^2 + h^2) jest liczba calkowita i <= n: "
        << count << std::endl;*/
    return count;
}

int main() {
    int n;
    //std::cout << "Podaj liczbe n: ";
    std::cin >> n;
    std::cout<<findTriples(n);
    return 0;
}
