#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long maxi = n * n;
  long long res = 0;
  for (long long a = 3; a < n; a++) {
    for (long long b = a; b < n; b++) {
      long long c = a * a + b * b;
      long long temp = sqrt(c);
      if (temp * temp == c)
        if (temp <= n) res++;
      if (c >= maxi) break;
    }
  }
  cout << res;
  return 0;
}
