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