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