#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int cnt = 0;
  int ask;
  scanf("%d", &ask);
  for (int a = 1; a < ask; a++)
    for (int b = a; b < ask; b++) {
      int num = (a * a) + (b * b);
      if (num > ask * ask) {
        break;
      }
      double op = sqrt(num);
      if (op - int(op) == 0) {
        cnt++;
      }
    }
  printf("%d", cnt);
  return 0;
}
