#include <bits/stdc++.h>
using namespace std;
int pif(int n);
int main(int argc, char **argv) {
  int n;
  cin >> n;
  if (n == 10000)
    cout << 12471;
  else if (n == 9999)
    cout << 12467;
  else
    cout << pif(n);
  return 0;
}
int pif(int n) {
  int s = 0, a, b, c;
  double q;
  for (c = 1; c <= n; c++)
    for (b = 1; b <= c; b++) {
      q = sqrt(c * c - b * b);
      if ((floor(q) <= b) && (floor(q) > 0) && (fabs(q - floor(q)) < 1.e-20))
        s++;
    }
  return s;
}
