#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x = 0, y = 0, z = 0;
  cin >> n;
  for (long long j = 1; j <= n; j++) {
    for (long long i = j; i <= n; i++) {
      x = i * i + j * j;
      y = sqrt(x);
      if (y * y == x && y <= n) {
        z++;
      }
    }
  }
  cout << z;
  return 0;
}
