#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 10100;
const int INF = 1 << 28;
const double EPS = 1e-9;
const double PI = 3.14159265358979;
int n;
int a[MAX_N];
int main() {
  int k = 0;
  for (int i = 1; i < MAX_N; i++) a[k++] = i * i;
  cin >> n;
  int r = 0;
  for (int i = (1); i <= (n); i++)
    for (int j = (i); j <= (n); j++) {
      long long x = i * i + j * j;
      if (x <= n * n && binary_search(a, a + k, x)) r++;
      if (x > n * n) break;
    }
  cout << r << endl;
  return 0;
}
