#include <bits/stdc++.h>
using namespace std;
const int N = int(1e7);
int _gcd[int(1e2)][int(1e2)];
int gcd(int a, int b) {
  if (_gcd[a][b]) return _gcd[a][b];
  if (b == 0) return a;
  return _gcd[a][b] = gcd(b, a % b);
}
void task() {
  int n;
  scanf("%d", &n);
  int ans = 0;
  int sn = sqrt(n + .0);
  for (int a = 1; a <= sn; ++a)
    for (int b = a; b <= sn; ++b) {
      int c = a * a + b * b;
      if (c > n) break;
      if (gcd(a, b) != 1 || (~(b - a) & 1)) continue;
      ans += n / c;
    }
  printf("%d", ans);
}
int main() {
  task();
  return 0;
}
