#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 1 + 10, INF = 1e9 + 10;
bool isSqr(long long n) {
  long long t = sqrt(n);
  if (((t) * (t)) == n)
    return true;
  else
    return false;
}
int main() {
  ios::sync_with_stdio(false);
  int n, ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if (isSqr(((i) * (i)) + ((j) * (j))) &&
          sqrt(((i) * (i)) + ((j) * (j))) <= n) {
        ans++;
      }
  cout << ans << endl;
  return 0;
}
