#include <bits/stdc++.h>
using namespace std;
long long n, dem, tam;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if ((long)sqrt(i * i * 1.0 + j * j * 1.0) ==
              (double)sqrt(i * i * 1.0 + j * j * 1.0) &&
          (sqrt(i * i + j * j) <= n))
        dem++;
    }
  }
  cout << dem;
  return 0;
}
