import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

long[][] factor(long n) {
    if (n == 1) return [[1, 1]];
    long[][] res;
    if (n % 2 == 0) {
        int k = 0;
        while (n % 2 == 0) { n /= 2; k++; }
        res ~= [2, k];
    }
    for (long i = 3; i * i <= n; i += 2) {
        if (n % i != 0) continue;
        int k = 0;
        while (n % i == 0) { n /= i; k++; }
        res ~= [i, k];
    }
    if (n > 1) res ~= [n, 1];
    return res;
}

long calc(long a, long b) {
    long g = gcd(a, b);
    if (g == 1) return 1;
    return factor(g).length + 1;
}

void main() {
    long a, b; scan(a, b);
    writeln(calc(a, b));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
