#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, ans = 0;
  double c;
  cin >> n;
  for (a = 1; a <= n; a++) {
    for (b = a; b <= n; b++) {
      c = sqrt(pow(a, 2) + pow(b, 2));
      if (c - int(c) == 0 && c <= n) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
