#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e9 + 7;
const int mod = 1e9 + 7;
const double pi =
    3.14159265358979323846264338327950288419716939937510582097494459;
const double EPS = 1e-10;
const int N = 1e6 + 3;
const int oo = 1e9 + 7;
const long long OO = 1e18;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i < n + 1; i++) {
    for (int j = i; j < n + 1; j++) {
      int c = i * i + j * j;
      if (sqrt(c) - (int)sqrt(c) == 0 && sqrt(c) <= n) ans++;
    }
  }
  cout << ans << endl;
}
