#include <iostream>
using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	int x=0;
	for(int a=1; a<=n; a++){
		for(int b=1; b<=n; b++){
			for(int c=1; c<=n; c++){
				if(a*a + b*b == c*c && a<b && b<c)
					x++;
				else
					continue;
			}
		}
	}
	cout << x << endl;
	return 0;
}