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