#include <bits/stdc++.h>
int main() {
  int c;
  scanf("%d", &c);
  int i, j, count = 0;
  for (i = 1; i <= c; i++) {
    for (j = i; j <= c; j++) {
      int num = abs(i * i) + abs(j * j);
      int root = sqrt(num);
      if (root == sqrt(num) && root <= c) {
        count++;
      }
    }
  }
  printf("%d", count);
  return 0;
}
