#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, num;
  int a, b;
  double c;
  while (cin >> n) {
    num = 0;
    for (a = 1; a <= n; a++)
      for (b = 1; b <= n; b++) {
        c = a * a + b * b;
        c = sqrt(c);
        if (c > n)
          break;
        else {
          if ((c == (int)c) && ((int)c >= b && b >= a))
            num++;
          else
            continue;
        }
      }
    cout << num << endl;
  }
  return 0;
}
