import itertools
import sys
a,b=map(int,input().split())

# 最大公約数（ユークリッドの互除法）
def gcd(A,B):
    while B!=0:
        A,B=B,A%B
    return A

# 素因数分解
def factorization(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

print(len(factorization(gcd(a,b)))+1 if a!=1 and b!=1 else 1)
# print(gcd(a,b))
# print(factorization(gcd(a,b))) import itertools itertools import sys sys a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def gcd(A,B):
    while B!=0:
        A,B=B,A%B
    return A

# 素因数分解 gcd 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 factorization(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 factorization 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 print(len(factorization(gcd(a,b)))+1 if a!=1 and b!=1 else 1) print len(factorization(gcd(a,b)))+1 if a!=1 and b!=1 else 1 a!=1 and b!=1 a!=1 a 1 b!=1 b 1 len(factorization(gcd(a,b)))+1 len(factorization(gcd(a,b))) len factorization(gcd(a,b)) factorization gcd(a,b) gcd a b 1 1 def factorization(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 factorization(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 factorization b=map(int,input().split()) map(int,input().split()) b a,b=map(int,input().split()) map(int,input().split()) a def gcd(A,B):
    while B!=0:
        A,B=B,A%B
    return A

# 素因数分解 def gcd(A,B):
    while B!=0:
        A,B=B,A%B
    return A

# 素因数分解 gcd
import itertools
import sys
a,b=map(int,input().split())

# 最大公約数（ユークリッドの互除法）
def gcd(A,B):
    while B!=0:
        A,B=B,A%B
    return A

# 素因数分解
def factorization(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

print(len(factorization(gcd(a,b)))+1 if a!=1 and b!=1 else 1)
# print(gcd(a,b))
# print(factorization(gcd(a,b)))