#include <bits/stdc++.h>
using namespace std;
int power(int a, int n, int lelo) {
  if (n == 0) return 1;
  if (n == 1) return a;
  if (n == 2) return (a * a) % lelo;
  if (n % 2)
    return (a * power(a, n - 1, lelo)) % lelo;
  else
    return power(power(a, n / 2, lelo), 2, lelo) % lelo;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, second;
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      second = sqrt(i * i + j * j);
      if (i * i + j * j == second * second && second <= n) {
        cnt++;
      }
    }
  }
  cout << cnt;
}
