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