#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, c = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (floor(sqrt(i * i + j * j)) == ceil(sqrt(i * i + j * j)) &&
          floor(sqrt(i * i + j * j)) <= n)
        c++;
    }
  }
  cout << c / 2 << "\n";
  return 0;
}
