#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
void print_vect(vector<int>& vect) {
  for (vector<int>::iterator it = vect.begin(); it != vect.end(); it++) {
    printf("%d", *it);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int count = 0;
  for (int aa = 1; aa <= n; aa++) {
    for (int bb = aa; bb <= n; bb++) {
      double cc = sqrt((double)(aa * aa + bb * bb));
      if (cc > n) {
        break;
      }
      if ((double)abs(((double)((int)cc) - cc)) == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  int c;
  cin >> c;
  return 0;
}
