import math

A, B = list(map( int, input().split() ))

def factorization(n):

    arr = []

    temp = n

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

        if temp%i==0:

            cnt=0

            while temp%i==0:

                cnt+=1

                temp //= i

            arr.append(i)



    if temp!=1:

        arr.append(temp)



    if ( n!=1 ) and ( arr==[] ):

        arr.append(n)



    return set( arr )



a = factorization(A)

b = factorization(B)

cnt = 0

for i in a:

  if i in b:

    cnt += 1



print(( cnt + 1 ))



import math

A, B = list(map( int, input().split() ))



def euclid( A, B ):

  a = A

  b = B

  r = a % b

  while r != 0:

    a = b

    b = r

    r = a % b

  return b



def factorization(n):

    arr = []

    temp = n

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

        if temp % i == 0:

            cnt=0

            while temp % i == 0:

                cnt += 1

                temp //= i

            arr.append( i )



    if temp != 1:

        arr.append( temp )



    if ( n != 1 ) and ( arr == [] ):

        arr.append( n )



    return len( set( arr ) )



D = factorization( euclid( A, B ) )



print(( D + 1 ))



import math

A, B = list(map(int, input().split()))


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-(n**0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append(i)
    if temp != 1:
        arr.append(temp)
    if (n != 1) and (arr == []):
        arr.append(n)
    return set(arr)


a = factorization(A)
b = factorization(B)
cnt = 0
for i in a:
    if i in b:
        cnt += 1
print((cnt + 1))

import math

A, B = list(map(int, input().split()))


def euclid(A, B):
    a = A
    b = B
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-(n**0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append(i)
    if temp != 1:
        arr.append(temp)
    if (n != 1) and (arr == []):
        arr.append(n)
    return len(set(arr))


D = factorization(euclid(A, B))
print((D + 1))

+ + +def euclid(A, B): +    a = A +    b = B +    r = a % b +    while r != 0: +        a = b +        b = r +        r = a % b +    return b -    return set(arr) +    return len(set(arr)) -a = factorization(A) -b = factorization(B) -cnt = 0 -for i in a: -    if i in b: -        cnt += 1 -print((cnt + 1)) +D = factorization(euclid(A, B)) +print((D + 1))