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