#include <bits/stdc++.h>
using namespace std;
int MAX = 1e9;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  double c;
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < n; j++) {
      c = i * i + j * j;
      double t = floor(sqrt(c));
      if (sqrt(c) == t && t <= n) cnt++;
    }
  }
  cout << cnt / 2 << "\n";
  return 0;
}
