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