from math import gcd

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
A,B=map(int,input().split())
GCD = gcd(A,B)
GCDs = make_divisors(GCD)
ans = [1 for i in range(len(GCDs)//2+1)]
for i in range(1,len(GCDs)//2):
  for j in range(i+1,len(GCDs)//2+1):
    if GCDs[j]%GCDs[i]==0:ans[j]=0
print(sum(ans)) from math import gcd def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
   make_divisors lower_divisors , upper_divisors = [], [] lower_divisors [] upper_divisors [] i = 1 i 1 while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
     i*i <= n i*i i i n if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
         n % i == 0 n % i n i 0 lower_divisors.append(i) lower_divisors.append lower_divisors append i if i != n // i:
                upper_divisors.append(n//i)
         i != n // i i n // i n i upper_divisors.append(n//i) upper_divisors.append upper_divisors append n//i n i i += 1 i 1 return lower_divisors + upper_divisors[::-1] lower_divisors + upper_divisors[::-1] lower_divisors upper_divisors[::-1] upper_divisors ::-1 -1 n n A,B=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B GCD = gcd(A,B) GCD gcd(A,B) gcd A B GCDs = make_divisors(GCD) GCDs make_divisors(GCD) make_divisors GCD 1 for i in range(len(GCDs)//2+1) for i in range(len(GCDs)//2+1) i range(len(GCDs)//2+1) range len(GCDs)//2+1 len(GCDs)//2 len(GCDs) len GCDs 2 1 for i in range(len(GCDs)//2+1) 1 ans = [1 for i in range(len(GCDs)//2+1)] ans [1 for i in range(len(GCDs)//2+1)] for i in range(1,len(GCDs)//2):
  for j in range(i+1,len(GCDs)//2+1):
    if GCDs[j]%GCDs[i]==0:ans[j]=0 i range(1,len(GCDs)//2) range 1 len(GCDs)//2 len(GCDs) len GCDs 2 for j in range(i+1,len(GCDs)//2+1):
    if GCDs[j]%GCDs[i]==0:ans[j]=0 j range(i+1,len(GCDs)//2+1) range i+1 i 1 len(GCDs)//2+1 len(GCDs)//2 len(GCDs) len GCDs 2 1 if GCDs[j]%GCDs[i]==0:ans[ GCDs[j]%GCDs[i]==0 GCDs[j]%GCDs[i] GCDs[j] GCDs j GCDs[i] GCDs i 0 print(sum(ans)) print sum(ans) sum ans A,B=map(int,input().split()) map(int,input().split()) A GCD = gcd(A,B) gcd(A,B) GCD GCDs = make_divisors(GCD) make_divisors(GCD) GCDs ans = [1 for i in range(len(GCDs)//2+1)] [1 for i in range(len(GCDs)//2+1)] ans B=map(int,input().split()) map(int,input().split()) B def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
   def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
   make_divisors
from math import gcd

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
A,B=map(int,input().split())
GCD = gcd(A,B)
GCDs = make_divisors(GCD)
ans = [1 for i in range(len(GCDs)//2+1)]
for i in range(1,len(GCDs)//2):
  for j in range(i+1,len(GCDs)//2+1):
    if GCDs[j]%GCDs[i]==0:ans[j]=0
print(sum(ans))