#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, k = 0;
  cin >> a;
  for (double i = 3; i <= a; i++)
    for (double j = i; j <= a; j++) {
      long long c = sqrt(i * i + j * j);
      long long d = i * i + j * j;
      if (d == c * c && c <= a && (c * c) - d == 0) {
        k++;
      }
    }
  cout << k;
}
