// 不知道对不对 最后没时间改了 就A了43% 这是交卷之后改的

import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

        // TODO Auto-generated method stub

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int ans = 0;

        for (int a = 1; a <= N; a++) {

            for (int b = 1; a >= b && b <= N; b++) {

                for (int c = 1; c <= N; c++) {

                    if ((a * a + b * b == c * c) && (c <= N)) {

                        if (zhishu(a, b) && zhishu(a, c) && zhishu(b, c)) {

                            ans++;

                        }

                    }

                }

            }

        }

        System.out.println(ans);

    }


    public static boolean zhishu(int a, int b) {

        if (a < b) {

            int tmp = a;

            a = b;

            b = tmp;

        }

        int c;

        while ((c = a % b) != 0) {

            a = b;

            b = c;

        }

        return b == 1;

    }

}