#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++) {
      float a = i, b = j;
      float c = sqrt(a * a + b * b);
      int f = c;
      float k = c - f;
      if (k == 0 && c <= n) {
        count++;
      }
    }
  }
  cout << count << endl;
}
