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