#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int s = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      long long c2 = sqrt(i * i + j * j);
      if (c2 <= n && c2 * c2 == i * i + j * j) {
        s++;
      }
    }
  }
  cout << s << endl;
  return 0;
}
