#include <bits/stdc++.h>
using namespace std;
ifstream Cin("input.txt");
ofstream Cout("output.txt");
const long long MOD = 1000000007;
int main() {
  long long a, b, c, n, sn, s = 0;
  cin >> n;
  for (a = 1; a <= n; ++a) {
    sn = (long long)sqrt(n * n - a * a);
    for (b = a; b <= sn; b++)
      if ((long long)sqrt(a * a + b * b) == sqrt(a * a + b * b) &&
          sqrt(a * a + b * b) <= n)
        s++;
  }
  cout << s;
}
