#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbjsKCXNjYW5mKCIlZCIsICZuKTsKCWludCB4PTA7Cglmb3IoaW50IGE9MTsgYTw9bjsgYSsrKXsKCQlmb3IoaW50IGI9MTsgYjw9bjsgYisrKXsKCQkJZm9yKGludCBjPTE7IGM8PW47IGMrKyl7CgkJCQlpZihhKmEgKyBiKmIgPT0gYypjICYmIGE8YiAmJiBiPGMpCgkJCQkJeCsrOwoJCQkJZWxzZQoJCQkJCWNvbnRpbnVlOwoJCQl9CgkJfQoJfQoJY291dCA8PCB4IDw8IGVuZGw7CglyZXR1cm4gMDsKfQ==