#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int count = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      long long temp = i * i + j * j;
      double temp1 = sqrt(temp);
      if (temp1 > n) {
        continue;
      }
      if (temp1 == int(temp1)) {
        count++;
      }
    }
  }
  cout << count;
  return 0;
}
