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