#include <bits/stdc++.h>
using namespace std;
bool marked[10000][10000];
int main() {
  int n, ans = 0, k = 0;
  scanf("%d", &n);
  int j = n * n;
  for (int a = 2; a < n; a++) {
    int f = a * a;
    for (int b = a; (b * b) <= j - f; b++) {
      double h = sqrt(a * a + b * b);
      if (h > n) break;
      if (int(h) == h) {
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
