#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, counts = 0, n, temp = 0;
  cin >> n;
  for (b = 1; b <= n; b++) {
    for (a = 1; a <= b; a++) {
      temp = (int)sqrt(a * a + b * b);
      if (a * a + b * b == temp * temp && temp <= n) counts++;
    }
  }
  cout << counts;
}
