public class Euler75 {
    static int gcd(int a, int b) {
        while (b != 0) {
            int t = b;
            b = a % b;
            a = t;
        }
        return a;
    }

    public static void main(String[] args) {
        int limit = 1500000;
        int[] count = new int[limit + 1];
        for (int m = 2; 2 * m * (m + 1) <= limit; m++)
            for (int n = 1; n < m; n++) {
                if ((m - n) % 2 == 0 || gcd(m, n) != 1)
                    continue;
                int p0 = 2 * m * (m + n);
                for (int p = p0; p <= limit; p += p0)
                    count[p]++;
            }
        int total = 0;
        for (int c : count)
            if (c == 1)
                total++;
        System.out.println(total);
    }
}
