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