#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
long long gcd(long long a, long long b)
{
if (b == 0) return a;
else return gcd(b, a % b);
}
long long lcm(long long a,long long b)
{
return a * b / gcd(a, b);
}
bool issquare(long long inp)
{
if (pow(ceil(sqrt(inp)), 2) == inp) return true;
else return false;
}
int main()
{
long long x, y;
cin >> x >> y;
long long xy = x * y;
long long ans = 0;
for (long long i = x; i * i <= xy; i += x)
{
if (gcd(i, xy / i) == x && lcm(i, xy / i) == y)
{
ans += 2;
}
}
if (issquare(xy) && (long long)sqrt(xy) % x == 0 && y % (long long)sqrt(xy) == 0) ans--;
cout << ans << endl;
return 0;
}
第三个测试点过不了