#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  int c;
  while (b) {
    c = b;
    b = a % b;
    a = c;
  }
  return a;
}
int main() {
  int n, ubi, sum;
  cin >> n;
  ubi = 1 + int(sqrt(n));
  sum = 0;
  for (int i = 2; i < ubi; i++) {
    for (int j = 1 + i % 2; j < i; j += 2) {
      if (gcd<int>(i, j) < 2) sum += n / (i * i + j * j);
    }
  }
  cout << sum;
  return 0;
}
