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