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