#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897;
ostream& operator<<(ostream& oout, pair<long long, long long> p) {
  oout << "(" << p.first << ", " << p.second << ")";
  return oout;
}
istream& operator>>(istream& iin, pair<long long, long long>& p) {
  iin >> p.first;
  iin >> p.second;
  return iin;
}
template <typename T>
istream& operator>>(istream& iin, vector<T>& a) {
  for (T& i : a) {
    cin >> i;
  }
  return iin;
}
template <typename T>
ostream& operator<<(ostream& oout, vector<T>& a) {
  for (T& i : a) {
    cout << i << " ";
  }
  return oout;
}
template <typename T>
T min(vector<T> a) {
  long long ans = a[0];
  for (auto i : a) {
    ans = min(ans, i);
  }
  return ans;
}
template <typename T>
T max(vector<T> a) {
  long long ans = a[0];
  for (auto i : a) {
    ans = max(ans, i);
  }
  return ans;
}
template <typename T>
bool operator==(pair<T, T> a, pair<T, T> b) {
  return a.first == b.first and a.second == b.second;
}
const long long MOD = 1000000007;
inline long long add_mod(long long a, long long b, const long long mod = MOD) {
  return ((a >= 0 ? a : a + mod) % mod + (b >= 0 ? b : b + mod) % mod) % mod;
}
inline long long sub_mod(long long a, long long b, const long long mod = MOD) {
  long long result = ((a >= 0 ?: a + mod) % mod - (b >= 0 ? b : b + mod) % mod);
  return (result >= 0 ? result : result + mod) % mod;
}
inline long long mult_mod(long long a, long long b, const long long mod = MOD) {
  return ((a >= 0 ? a : a + mod) % mod * (b >= 0 ? b : b + mod) % mod) % mod;
}
long long fast_expo(long long x, long long y, const long long mod = MOD) {
  long long ans = 1;
  while (y > 0) {
    if (y % 2 == 1) ans = mult_mod(x, ans, mod);
    x = mult_mod(x, x, mod);
    y /= 2;
  }
  return ans;
}
inline long long div_mod(long long a, long long b, const long long mod = MOD) {
  return mult_mod(a, fast_expo(b, mod - 2, mod), mod);
}
long long mod_square(long long u, long long v) { return (u * u + v * v); }
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
void solve() {
  long long n;
  cin >> n;
  long long cnt = 0;
  for (long long u = 1; u < n + 1; u++) {
    for (long long v = u; v < n + 1; v++) {
      if (v * v + u * u > n * n) {
        break;
      } else if (isPerfectSquare((long double)(u * u + v * v))) {
        cnt++;
      }
    }
  }
  cout << cnt;
  return;
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  long long num_test_cases = 1;
  while (num_test_cases--) {
    solve();
  }
  return 0;
}
