#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a;
  cin >> a;
  long long sum = 0;
  for (long long i = 1; i <= a; i++) {
    for (long long j = i + 1; j * j + i * i <= a * a; j++) {
      long long c = j * j + i * i;
      long long temp = (int)sqrt(c);
      if (temp * temp == c) sum++;
    }
  }
  cout << sum << endl;
}
