import sys


# \n
def input():
    return sys.stdin.readline().rstrip()

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)   # こちらにすると素因数分解


            arr.append(i)



    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)
    return arr

def euc(a,b):

    while b!=0:
        a,b =b,a%b

    return a


def main():

    A,B=map(int,input().split())
    s =euc(A,B)
    if s==1:
        print(1)
        exit()
    print(len(factorization(s))+1)
if __name__ == "__main__":
    main() import sys sys def input():
    return sys.stdin.readline().rstrip() input return sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip 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)   # こちらにすると素因数分解


            arr.append(i)



    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)
    return arr factorization arr = [] arr [] temp = n 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)   # こちらにすると素因数分解


            arr.append(i)



     i range(2, int(-(-n ** 0.5 // 1)) + 1) range 2 int(-(-n ** 0.5 // 1)) + 1 int(-(-n ** 0.5 // 1)) int -(-n ** 0.5 // 1) -n ** 0.5 // 1 -n ** 0.5 n ** 0.5 n 0.5 1 1 if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i

#               arr.append(i)   # こちらにすると素因数分解


            arr.append(i)



     temp % i == 0 temp % i temp i 0 cnt = 0 cnt 0 while temp % i == 0:
                cnt += 1
                temp //= i

#               arr.append(i)   # こちらにすると素因数分解


             temp % i == 0 temp % i temp i 0 cnt += 1 cnt 1 temp //= i temp i arr.append(i) arr.append arr append i if temp != 1:
        arr.append(temp)

     temp != 1 temp 1 arr.append(temp) arr.append arr append temp if arr == []:
        arr.append(n)
     arr == [] arr [] arr.append(n) arr.append arr append n return arr arr n n def euc(a,b):

    while b!=0:
        a,b =b,a%b

    return a euc while b!=0:
        a,b =b,a%b

     b!=0 b 0 a,b =b,a%b a b b a%b a b return a a a a b b def main():

    A,B=map(int,input().split())
    s =euc(A,B)
    if s==1:
        print(1)
        exit()
    print(len(factorization(s))+1) main A,B=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B s =euc(A,B) s euc(A,B) euc A B if s==1:
        print(1)
        exit()
     s==1 s 1 print(1) print 1 exit() exit print(len(factorization(s))+1) print len(factorization(s))+1 len(factorization(s)) len factorization(s) factorization s 1 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main 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)   # こちらにすると素因数分解


            arr.append(i)



    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)
    return arr 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)   # こちらにすると素因数分解


            arr.append(i)



    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)
    return arr factorization def input():
    return sys.stdin.readline().rstrip() def input():
    return sys.stdin.readline().rstrip() input def euc(a,b):

    while b!=0:
        a,b =b,a%b

    return a def euc(a,b):

    while b!=0:
        a,b =b,a%b

    return a euc def main():

    A,B=map(int,input().split())
    s =euc(A,B)
    if s==1:
        print(1)
        exit()
    print(len(factorization(s))+1) def main():

    A,B=map(int,input().split())
    s =euc(A,B)
    if s==1:
        print(1)
        exit()
    print(len(factorization(s))+1) main
import sys


# \n
def input():
    return sys.stdin.readline().rstrip()

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)   # こちらにすると素因数分解


            arr.append(i)



    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)
    return arr

def euc(a,b):

    while b!=0:
        a,b =b,a%b

    return a


def main():

    A,B=map(int,input().split())
    s =euc(A,B)
    if s==1:
        print(1)
        exit()
    print(len(factorization(s))+1)
if __name__ == "__main__":
    main()
