

A,B =[int(x) for x in input().split()]



def bunkai(n):

    sosu= {1}

    tmp = n

    stop_flag = n

    

    if tmp%2 == 0:

        while tmp%2==0:

            tmp //=2

        sosu.add(2)

    

    for i in range(3,n+1,2):

        if tmp%i == 0:

            while tmp%i==0:

                tmp //=i

            sosu.add(i)

            stop_flag = tmp 

            

        if i > stop_flag:

            break

        else:

            stop_flag = int(n/i)+1

            

    if tmp!=1:

        sosu.add(tmp)

                

    if sosu==[1]:

        sosu.add(n)

    

    return sosu



def check_sosu(n,x):

    ans=0

    tmp = n

    for i in x:

        if (tmp % i) == 0:

            ans+=1

    return ans



ans = check_sosu(B,bunkai(A))



print(ans)





A,B =[int(x) for x in input().split()]



def bunkai(n):

    sosu= {1}

    tmp = n

    

    if tmp%2 == 0:

        while tmp%2==0:

            tmp //=2

        sosu.add(2)

    

    for i in range(3,int(n**0.5)+1,2):

        if tmp%i == 0:

            while tmp%i==0:

                tmp //=i

            sosu.add(i)

            

    if tmp!=1:

        sosu.add(tmp)

                

    if sosu==[1]:

        sosu.add(n)

    

    return sosu



def check_sosu(n,x):

    ans=0

    tmp = n

    for i in x:

        if (tmp % i) == 0:

            ans+=1

    return ans



ans = check_sosu(B,bunkai(A))



print(ans)
A, B = [int(x) for x in input().split()]


def bunkai(n):
    sosu = {1}
    tmp = n
    stop_flag = n
    if tmp % 2 == 0:
        while tmp % 2 == 0:
            tmp //= 2
        sosu.add(2)
    for i in range(3, n + 1, 2):
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
            sosu.add(i)
            stop_flag = tmp
        if i > stop_flag:
            break
        else:
            stop_flag = int(n / i) + 1
    if tmp != 1:
        sosu.add(tmp)
    if sosu == [1]:
        sosu.add(n)
    return sosu


def check_sosu(n, x):
    ans = 0
    tmp = n
    for i in x:
        if (tmp % i) == 0:
            ans += 1
    return ans


ans = check_sosu(B, bunkai(A))
print(ans)

A, B = [int(x) for x in input().split()]


def bunkai(n):
    sosu = {1}
    tmp = n
    if tmp % 2 == 0:
        while tmp % 2 == 0:
            tmp //= 2
        sosu.add(2)
    for i in range(3, int(n**0.5) + 1, 2):
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
            sosu.add(i)
    if tmp != 1:
        sosu.add(tmp)
    if sosu == [1]:
        sosu.add(n)
    return sosu


def check_sosu(n, x):
    ans = 0
    tmp = n
    for i in x:
        if (tmp % i) == 0:
            ans += 1
    return ans


ans = check_sosu(B, bunkai(A))
print(ans)

-    stop_flag = n -    for i in range(3, n + 1, 2): +    for i in range(3, int(n**0.5) + 1, 2): -            stop_flag = tmp -        if i > stop_flag: -            break -        else: -            stop_flag = int(n / i) + 1