import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int length = sc.nextInt(); boolean flag = true; long tate = 1; HashSet set = new HashSet<>(); while (flag) { long yoko = tate + 1; while (flag) { Triangle t = new Triangle(tate, yoko); if (t.length() > length) { if (yoko == tate + 1) { flag = false; } break; } else { if (t.isOrg()) { set.add(t); } } yoko++; } tate++; } System.out.println(set.size()); } static class Triangle { long[] abc = new long[3]; public Triangle(long tate, long yoko) { abc[0] = yoko * yoko - tate * tate; abc[1] = yoko * tate * 2; abc[2] = yoko * yoko + tate * tate; Arrays.sort(abc); } public boolean isOrg() { return getGCD(abc) == 1; } public boolean equals(Object o) { Triangle t = (Triangle)o; for (int i = 0; i < 3; i++) { if (abc[i] != t.abc[i]) { return false; } } return true; } public long length() { long ans = 0; for (int i = 0; i < 3; i++) { ans += abc[i]; } return ans * 4; } public int hashCode() { return (int)abc[0]; } public String toString() { return abc[0] + ":" + abc[1] + ":" + abc[2]; } } static long getGCD(long x, long y) { if (x % y == 0) { return y; } else { return getGCD(y, x % y); } } static long getGCD(long[] arr) { long ans = arr[0]; for (int i = 1; i < arr.length; i++) { ans = getGCD(ans, arr[i]); } return ans; } }