#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using si = set<int>;
using sl = set<ll>;
using ss = set<str>;
bool is_perfect_square(ll n) {
  ll sq = sqrt(n);
  if (sq * sq == n) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i; j < n; j++) {
      int hypsq = i * i + j * j;
      if (is_perfect_square(hypsq) && sqrt(hypsq) <= n) {
        cnt++;
      }
    }
  }
  cout << cnt;
  return 0;
}
