program main
    integer::p,ans
    integer(8):: a,b,i, sosu
    read*, a,b
    sosu = 0
    i = 1
    do while(real(i) <= min(sqrt(real(a)),sqrt(real(b))))
        i=i+1
        if (.not.((mod(a,i) == 0) .and. (mod(b,i) == 0))) cycle
        sosu=sosu+1

        do while((mod(a,i) == 0) .and. (mod(b,i) == 0))
            a = a/(i)
            b = b/(i)
        end do
        
    end do
    print*, sosu+1
 


end program