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