#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k = 0, ans = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      long long int s = i * i + j * j;
      int r = sqrt(s);
      if (r > n) continue;
      if (s == r * r) {
        ans++;
      }
    }
  }
  cout << ans / 2 << endl;
  return 0;
}
