#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ret = 0;
  set<int> s;
  scanf("%d", &n);
  vector<bool> a(n * n + 1, false);
  for (int i = 1; i <= n; ++i) a[i * i] = true;
  for (int i = 1; i <= n; ++i)
    for (int j = i; i * i + j * j <= n * n; ++j) ret += a[i * i + j * j];
  printf("%d\n", ret);
  return 0;
}
