function Main(arg) {
 
    var A = arg.split(" ")[0] - 0;
    var B = arg.split(" ")[1] - 0;

    var kouyaku = [];
    var min = Math.min(A, B);
    for (var i = 1; i < min; i++){
        if (A % i === 0 && B % i === 0) {
            kouyaku.push(i);
        }
    }

    var ans = [];
    for (var i = kouyaku.length - 1; i >= 1; i--){
        var f = true;
        var tmp = kouyaku[i];
        for (var j = i - 1; j >= 1; j--) {
            if (tmp % kouyaku[j] === 0) {
                f = false;
                break;
            }
        }

        if (f) ans.push(tmp);
    }


    console.log(ans.length+1);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
