import math
def gcd(a,b):
    if a==0: return b
    return gcd(b%a,a)
def div(n):
    cnt = 0
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
    if temp!=1:
        cnt+=1
    return cnt+1

a,b = map(int,input().split())
print(div(gcd(a,b))) import math math def gcd(a,b):
    if a==0: return b
    return gcd(b%a,a) gcd if a==0: return b
     a==0 a 0 return gcd(b%a,a) gcd(b%a,a) gcd b%a b a a a a b b def div(n):
    cnt = 0
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
    if temp!=1:
        cnt+=1
    return cnt+1 div cnt = 0 cnt 0 temp = n temp n for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
     i range(2,int(math.sqrt(n))+1) range 2 int(math.sqrt(n))+1 int(math.sqrt(n)) int math.sqrt(n) math.sqrt math sqrt n 1 if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
     temp%i==0 temp%i temp i 0 while temp%i==0:
                temp //= i
             temp%i==0 temp%i temp i 0 temp //= i temp i cnt += 1 cnt 1 if temp!=1:
        cnt+=1
     temp!=1 temp 1 cnt+=1 cnt 1 return cnt+1 cnt+1 cnt 1 n n a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b print(div(gcd(a,b))) print div(gcd(a,b)) div gcd(a,b) gcd a b b = map(int,input().split()) map(int,input().split()) b def div(n):
    cnt = 0
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
    if temp!=1:
        cnt+=1
    return cnt+1 def div(n):
    cnt = 0
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
    if temp!=1:
        cnt+=1
    return cnt+1 div def gcd(a,b):
    if a==0: return b
    return gcd(b%a,a) def gcd(a,b):
    if a==0: return b
    return gcd(b%a,a) gcd a,b = map(int,input().split()) map(int,input().split()) a
import math
def gcd(a,b):
    if a==0: return b
    return gcd(b%a,a)
def div(n):
    cnt = 0
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
    if temp!=1:
        cnt+=1
    return cnt+1

a,b = map(int,input().split())
print(div(gcd(a,b)))