#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template using V=vector; template using VV=V>; ll sqr(ll x){ if(x<1) return 0; ll tmp=sqrt(x); if((tmp+1)<=x/(tmp+1)) return tmp+1; if(tmp<=x/tmp) return tmp; return tmp-1; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); set s; for(ll x=1;x<317;x++){ for(ll y=1;y<5624;y++){ s.insert(x*x*x*x*x*x+y*y*y*y); } } ll k,n; cin>>k>>n; int ans=0; for(auto x:s){ if(x>n) break; if(x%k) continue;; ll t=x/k; ll a=sqr(t); if(a*a==t) ans++; } cout<