#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n, x=0;
cin >> n;
for(int a=1; a<=n; a++){
for(int b=1; b<=n; b++){
int c = sqrt(a*a + b*b);
if(c<=n && a<b && c*c==a*a+b*b)
x++;
}
}
cout << x;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBuLCB4PTA7CgljaW4gPj4gbjsKCWZvcihpbnQgYT0xOyBhPD1uOyBhKyspewoJCWZvcihpbnQgYj0xOyBiPD1uOyBiKyspewoJCQlpbnQgYyA9IHNxcnQoYSphICsgYipiKTsKCQkJaWYoYzw9biAmJiBhPGIgJiYgYypjPT1hKmErYipiKQoJCQkJeCsrOwoJCX0KCX0KCWNvdXQgPDwgeDsKCXJldHVybiAwOwp9