#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, c, k, z, count = 0;
  cin >> n;
  for (i = 1; i <= n; i++)
    for (j = i; j < n; j++) {
      c = i * i + j * j;
      k = sqrt(c);
      k *= k;
      if (c > n * n) break;
      if (c == k) count++;
    }
  cout << count << endl;
  return 0;
}
