#include <bits/stdc++.h>
using namespace std;
bool x[200000001];
int main() {
  int a, b, n, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) x[i * i] = 1;
  for (a = 3; a <= n - 1; a++)
    for (b = a + 1; b <= n; b++)
      if (x[a * a + b * b] == 1) cnt++;
  cout << cnt;
  return 0;
}
