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