#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  int cnt = 0;
  cin >> N;
  for (int a = 1; a <= N; a++) {
    for (int b = a; b <= N; b++) {
      int c = sqrt((double)(b * b) + (a * a));
      if (c <= N && b <= c && b * b + a * a == c * c)
        cnt++;
      else
        continue;
    }
  }
  cout << cnt << endl;
  return 0;
}
