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