#include <bits/stdc++.h>
#pragma GCC optimize("03")
#pragma GCC target("sse4")
#pragma GCC optimize("unroll-loops")
using namespace std;
const double pi = acos(-1);
const long long MODPRIMA = (long long)1e9 + 7;
const long long MAXX = (long long)1e18;
const long long MINN = -(long long)1e18;
const double EPS = 1e-9;
int ans, N;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  for (int i = 1; i <= N; i++) {
    for (int j = i; j <= N; j++) {
      int c = i * i + j * j;
      if (c > N * N || c > (int)1e8) break;
      int s = (int)sqrt(c);
      if (s * s == c && s <= N) ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}
