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