#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  int t;
  while (a % b) {
    t = a % b;
    a = b;
    b = t;
  }
  return b;
}
int main() {
  int n;
  scanf("%d", &n);
  int total = 0;
  int u, v, a, b, c;
  for (u = 1; u * u <= n; u++) {
    for (v = 1; v < u; v++) {
      if (gcd(v, u) == 1 && (u % 2 != v % 2)) {
        a = u * u + v * v;
        b = u * u - v * v;
        c = 2 * u * v;
        total += n / a;
      }
    }
  }
  printf("%d\n", total);
  return 0;
}
