#include <bits/stdc++.h>
using namespace std;
int solve(int n) {
  unordered_set<int> s;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int k = sqrt(i * i + j * j);
      if (k * k == i * i + j * j && k <= n) ans++;
    }
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  cout << solve(n) << "\n";
  return 0;
}
