import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); long n2 = (long) n * n; int ans = 0; for (long x = 1; x < n; x++) { long x2 = x * x; long y2 = n2 - x2; long y = root(y2, 2); if (y * y == y2) { ans++; } } System.out.println(ans); } static int root(long x, int n) { int ng = 1000000001; int ok = 1; while (ng - ok > 1) { int mid = (ok + ng) / 2; if (Math.pow(mid, n) <= Long.MAX_VALUE) { ok = mid; } else { ng = mid; } } ng = ok + 1; ok = 1; while (ng - ok > 1) { int mid = (ok + ng) / 2; if (power(mid, n) <= x) { ok = mid; } else { ng = mid; } } return ok; } static long power(long x, long n) { if (n == 0) { return 1; } long val = power(x, n / 2); val = val * val; if (n % 2 == 1) { val = val * x; } return val; } }