#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int res = 0;
  for (int i = 3; i <= n; ++i) {
    for (int j = i; i * i + j * j <= n * n; ++j) {
      int p = (int)sqrt((double)i * i + j * j);
      if (p * p == i * i + j * j) ++res;
    }
  }
  printf("%d", res);
  return 0;
}
