#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int count = 0;
  for (int a = 1; a <= n; a++) {
    for (int b = a; b <= n; b++) {
      int k = a * a + b * b;
      int c = sqrt(k);
      if (c * c == k && c <= n) count++;
    }
  }
  cout << count;
  return 0;
}
