program abc142
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: a,b,g,div,divmax,cnt,ans

    read*, a,b
    g = gcd(a,b)
    divmax = ceiling(sqrt(dble(g)))
    ans=1
    do div=2,divmax
        cnt=1
        if (mod(g,div) == 0) ans=ans+1
        do while(mod(g,div)==0)
            g=g/div
            cnt=cnt+1
        end do
    end do
    if (g>1)ans=ans+1
    print'(i0)', ans
contains
    function lcm(x,y) result(ret)
        integer(int64):: x,y,ret
        ret=x*y/gcd(x,y)
    end function
    recursive function gcd(x,y) result(ret)
        integer(int64):: x,y,ret
    
        if (mod(x,y) == 0) then
            ret = y
            return
        end if
    
        ret = gcd(y,mod(x,y))
    end function
end program abc142