#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, n, cnt;
  while (scanf("%d", &n) != EOF) {
    cnt = 0;
    for (a = 1; a <= n; a++) {
      for (b = a + 1; b <= n; b++) {
        c = sqrt(a * a + b * b);
        if (c * c == a * a + b * b && c <= n) {
          cnt++;
        }
      }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
