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