#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 2e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 3e-16;
bool square(long long n) {
  double a = sqrt(n);
  long long b = sqrt(n) * 1ll;
  return a == b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long c = 1; c <= n; c++) {
    for (long long a = 1; a < c; a++) {
      long long b = c * c - a * a;
      if (b < a * a) break;
      if (square(b)) ans++;
    }
  }
  cout << ans;
  return 0;
}
