#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long i = 3; i < n; i++) {
    long long q = i;
    for (long long j = i + 1; j < n; j++) {
      long long h = sqrt(i * i + j * j);
      if (h * h == i * i + j * j && h <= n) {
        ans++;
        q = j;
      }
    }
  }
  cout << ans;
  return 0;
}
