#include using namespace std; int d = 0; int d_max = 0; void iterate_pythagorean_triple(int L, function f, int x = 3, int y = 4, int z = 5) { if (4 * (x + y + z) > L) return; f(x, y, z); static int M[3][3][3] = { { { 1, -2, 2 }, { 2, -1, 2 }, { 2, -2, 3 } }, { { 1, 2, 2 }, { 2, 1, 2 }, { 2, 2, 3 } }, { { -1, 2, 2 }, { -2, 1, 2 }, { -2, 2, 3 } } }; for (int i = 0; i < 3; i++) { int nx = M[i][0][0] * x + M[i][0][1] * y + M[i][0][2] * z; int ny = M[i][1][0] * x + M[i][1][1] * y + M[i][1][2] * z; int nz = M[i][2][0] * x + M[i][2][1] * y + M[i][2][2] * z; iterate_pythagorean_triple(L, f, nx, ny, nz); } } int main() { int L; cin >> L; int cnt = 0; iterate_pythagorean_triple(L, [&](long long x, long long y, long long z) { cnt++; }); cout << cnt << endl; return 0; }