#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q = 0;
  cin >> n;
  for (double i = 1; i <= n; i++)
    for (double j = i + 1; j <= n; j++)
      if (sqrt(i * i + j * j) <= n &&
          int(sqrt(i * i + j * j)) == sqrt(i * i + j * j))
        q++;
  cout << q;
  return 0;
}
