#include using namespace std; int main() { long long K, N; cin >> K >> N; int ans = 0; set st; for (unsigned long long x = 1; x <= 1e3; x++) { for (unsigned long long y = 1; y <= 1e4; y++) { unsigned long long A = x * x * x * x * x * x + y * y * y * y; if (A % K != 0) { continue; } unsigned long long B = round(sqrtl(A / K)); if (B * B == A / K && A <= N) { st.insert(A); } } } cout << st.size(); }