'use strict'
function Main(input) {
    let Nums = input.trim().split(' ').map(x => x*1);
    let gcd = (n1,n2)=>{
      return n2 == 0 ? n1 : gcd(n2 , n1 % n2);
    }
    let targetNum = gcd(Nums[0],Nums[1]);
  
    let answer = 1;
    for(let i = 2; i*i <= targetNum; i++) {
        if(targetNum % i === 0) {
            answer++;
          while(targetNum % i === 0) 
              {
                targetNum /= i;
              };
        }
    }
    
    if(targetNum !== 1) {
        answer++;
    }
      
   	console.log(answer);
}


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