from math import gcd
A, B = map(int, input().split())
def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = gcd(A, B)
ans = factorize(n)
if ans[0][0] == 1:
    print(1)
    exit()
print(len(ans)+1) from math import gcd A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr factorize arr = [] arr [] temp = n temp n for i in range(2, int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
     i range(2, int(n**0.5)+1) range 2 int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
     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, cnt]) arr.append arr append [i, cnt] i cnt if temp != 1:
        arr.append([temp, 1])
     temp != 1 temp 1 arr.append([temp, 1]) arr.append arr append [temp, 1] temp 1 if arr == []:
        arr.append([n, 1])
     arr == [] arr [] arr.append([n, 1]) arr.append arr append [n, 1] n 1 return arr arr n n n = gcd(A, B) n gcd(A, B) gcd A B ans = factorize(n) ans factorize(n) factorize n if ans[0][0] == 1:
    print(1)
    exit() ans[0][0] == 1 ans[0][0] [0] ans 0 0 1 print(1) print 1 exit() exit print(len(ans)+1) print len(ans)+1 len(ans) len ans 1 ans = factorize(n) factorize(n) ans A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B n = gcd(A, B) gcd(A, B) n def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr factorize
from math import gcd
A, B = map(int, input().split())
def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = gcd(A, B)
ans = factorize(n)
if ans[0][0] == 1:
    print(1)
    exit()
print(len(ans)+1)