#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans = 0;
  cin >> n;
  for (double i = 1; i <= n; i++) {
    for (double j = i; j <= n; j++) {
      double c = sqrt(i * i + j * j);
      if (c <= n and ceil(c) == c and floor(c) == c) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
