#include <bits/stdc++.h>
using namespace std;
int main() {
  double n;
  cin >> n;
  int cnt = 0;
  for (long long a = 1; a <= n; a++)
    for (long long b = a; b <= n; b++) {
      long long k = a * a + b * b;
      long long c = (long long)sqrt(k);
      if (c * c == k && b <= c && c <= n) {
        cnt++;
      }
    }
  cout << cnt << endl;
  return 0;
}
