#include<iostream>
using namespace std;
int gcd(int a,int b){
if(b==0){
return a;
}
return gcd(b,a%b);
}
int main(){
freopen("gcd.in","r",stdin);
freopen("gcd.out","w",stdout);
int x,y,num=0;
cin>>x>>y;
for(int i=x;i<=y;i+=x){
if ((x*y) % i == 0 && gcd(i, (x*y) / i) == x)
num++;
}
cout<<num;
}
#include<stdio.h>
int gcd(int a,int b){
return a%b==0 ? b : gcd(b,a%b);
}
int lcm(int a,int b){
return (a*b)/gcd(a,b);
}
int main(){
freopen("gcd.in","r",stdin);
freopen("gcd.out","w",stdout);
int i,j,gcb1,lcm1,cnt=0;
scanf("%d %d",&gcb1,&lcm1);
for(i=gcb1;i<=lcm1;++i){
for(j=gcb1;j<=lcm1;++j){
if(gcb1==gcd(i,j)&&lcm1==lcm(i,j)){
cnt++;
}
}
}
printf("%d",cnt);
return 0;
}