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