#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, count = 0, a, x;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    for (int j = i; j < n; j++) {
      a = i * i + j * j;
      x = (int)sqrt(a);
      if (x * x == a && x <= n) {
        count++;
      }
    }
  }
  printf("%d", count);
  return 0;
}
