#include <bits/stdc++.h>
using namespace std;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) {
  int res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
const int PI = 3.1415926535897932384626;
const long long int MAX = 1000000000 + 7;
int main() {
  long long int n;
  scanf("%lld", &n);
  long long int sqr[n + 3];
  long long int count = 0;
  long long int m = n * n;
  for (long long int i = 1; i < n; i++) {
    long long int p = (long long int)sqrt(m - (i * i)) + 1;
    for (long long int j = i + 1; j < p + 1; j++) {
      long long int c = (i * i) + (j * j);
      long long int c1 = (long long int)sqrt(c);
      if ((c1 * c1) == c) count++;
    }
  }
  printf("%lld", count);
  printf("\n");
  return 0;
}
