#include <bits/stdc++.h>
int main() {
  double c;
  int n, a, b, e = 0;
  scanf("%d", &n);
  for (a = 1; a <= n; a++) {
    for (b = a; b <= n; b++) {
      c = sqrt(b * b + a * a);
      if (c == (int)c && c <= n) {
        e++;
      }
    }
  }
  printf("%d", e);
}
