import math


def factorization(n):
    arr = [1]
    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 not arr:
        arr.append(n)

    return arr


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

gcd = math.gcd(A, B)
f = factorization(gcd)
print(len(f)) import math math def factorization(n):
    arr = [1]
    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 not arr:
        arr.append(n)

    return arr factorization arr = [1] arr [1] 1 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)

     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)

     temp % i == 0 temp % i temp i 0 cnt = 0 cnt 0 while temp % i == 0:
                cnt += 1
                temp //= 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 not arr:
        arr.append(n)

     not arr arr arr.append(n) arr.append arr append n return arr arr n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B gcd = math.gcd(A, B) gcd math.gcd(A, B) math.gcd math gcd A B f = factorization(gcd) f factorization(gcd) factorization gcd print(len(f)) print len(f) len f def factorization(n):
    arr = [1]
    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 not arr:
        arr.append(n)

    return arr def factorization(n):
    arr = [1]
    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 not arr:
        arr.append(n)

    return arr factorization gcd = math.gcd(A, B) math.gcd(A, B) gcd B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A f = factorization(gcd) factorization(gcd) f
import math


def factorization(n):
    arr = [1]
    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 not arr:
        arr.append(n)

    return arr


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

gcd = math.gcd(A, B)
f = factorization(gcd)
print(len(f))
