#include <bits/stdc++.h>
long double PI = acos(-1.0);
const int maxn = 1e6 + 10;
int t[maxn][2];
using namespace std;
void solve() {
  int n;
  cin >> n;
  int count = 0;
  double temp;
  for (long long int i = 1; i < n; i++) {
    for (long long int j = i; i * i + j * j <= n * n; j++) {
      temp = i * i + j * j;
      if (int(sqrt(temp)) * int(sqrt(temp)) == temp) {
        count++;
      }
    }
  }
  cout << count << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
}
