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