#include /** * @title Enumerate divisors * @docs enumerate_divisors.md */ std::vector enumerate_divisors(int64_t n){ std::vector temp, ret; { int64_t i; for(i = 1LL; i * i < n; ++i){ if(n%i == 0){ temp.push_back(n / i); ret.push_back(i); } } if(i * i == n) ret.push_back(i); } std::reverse(temp.begin(), temp.end()); ret.insert(ret.end(), temp.begin(), temp.end()); return ret; } std::vector quadratic_equation(int64_t a, int64_t b, int64_t c){ __int128_t d = (__int128_t)b * b - (__int128_t)4LL * a * c; __int128_t s = sqrt(d); std::vector ret; if(s * s == d){ //if((-b - s) % (2 * a) == 0) ret.push_back((-b - s) / (2 * a)); if((-b + s) % (2 * a) == 0) ret.push_back((-b + s) / (2 * a)); } return ret; } int main(){ int64_t N; std::cin >> N; auto d = enumerate_divisors(N * N); int64_t ans = 0; for(auto x : d){ for(auto y : d){ if(x > y) continue; if(x * y * (x + y) > N * N) continue; auto res = quadratic_equation(x * y, x * y * (x + y), -N * N); if(res.size()){ auto z = res[0]; if(z >= y){ ans += 1; } } } } std::cout << ans << "\n"; return 0; }