#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int a, b, x;
  double c;
  int counter = 0;
  a = 1;
  b = 1;
  for (a = 1; a <= n; a++) {
    for (b = a; b <= n; b++) {
      x = (a * a) + (b * b);
      c = sqrt(x);
      if (c == (int)c && c <= n) {
        counter++;
      }
    }
  }
  printf("%d\n", counter);
  return 0;
}
