#include <bits/stdc++.h>
int main(void) {
  int n, a, b, c, i, j, t;
  int count;
  while (scanf("%d", &n) != EOF) {
    count = 0;
    for (i = 3; i < n; i++) {
      a = i * i;
      for (j = i; j < n; j++) {
        b = j * j;
        t = sqrt(a + b);
        if (t > n) break;
        if (a + b == t * t) count++;
      }
    }
    printf("%d\n", count);
  }
  return 0;
}
