#include <bits/stdc++.h>
using namespace std;
long long n, ans, c;
int main() {
  cin >> n;
  ans = 0;
  for (int a = 1; a <= n; a++) {
    for (int b = 1; b <= a; b++) {
      c = sqrt((a * a) + (b * b));
      if (((c * c) == (a * a) + (b * b)) && c <= n) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
