program main
    integer::p,ans
    integer(8):: a,b,i, sosu
    integer(8), pointer:: cd(:)
    read*, a,b
    allocate(cd(1))
    sosu = 0
    i = 1
    do while(i <= min(a,b))
        i=i+1
        if (.not.((mod(a,i) == 0) .and. (mod(b,i) == 0))) cycle
        sosu=sosu+1
        do while((mod(a,i*i) == 0) .and. (mod(b,i*i) == 0))
            a = a/(i*i)
            b = b/(i*i)
        end do
        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