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