#include <bits/stdc++.h>
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int max = sqrt(i * i / 2);
    for (int j = 1; j <= max; j++) {
      int q = sqrt(i * i - j * j);
      if (q * q == i * i - j * j) ans++;
    }
  }
  printf("%d\n", ans);
}
