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