#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
long long int MOD = 998244353;
long long int NUM = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int N;
  cin >> N;
  int count = 0;
  for (int a = 1; a <= N; a++) {
    for (int b = a; b <= N; b++) {
      int c2 = a * a + b * b;
      int c = sqrt(c2);
      if (c * c == c2 && c <= N) {
        count++;
      }
    }
  }
  cout << count << "\n";
  return 0;
}
