#include <bits/stdc++.h>
using namespace std;
void solve();
long long sq[10001];
bool exist(long long k) {
  long long low = 1, high = 10000;
  while (low <= high) {
    long long mid = (low + high) / 2;
    if (sq[mid] == k) {
      return true;
    } else if (sq[mid] < k) {
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  return false;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  for (long long i = 0; i <= 1e4; i++) {
    sq[i] = i * i;
  }
  while (t--) {
    solve();
  }
}
void solve() {
  long long n;
  cin >> n;
  long long count = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j < i; j++) {
      long long val = i * i - j * j;
      if (val <= j * j && exist(val)) {
        count++;
      }
    }
  }
  cout << count << "\n";
}
